Created
May 23, 2012 00:10
-
-
Save regisd/2772460 to your computer and use it in GitHub Desktop.
Wordpress theme "response" by Cyberchimps should use the same RSS in the icon link and alternate link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add this function in functions.php | |
/** Replaces RSS link from HTML 'head' with custom feed also used with the 'social icon' */ | |
function response_feed_links() { | |
global $themename, $themeslug, $options; | |
$my_feed=$options->get($themeslug.'_rsslink'); | |
if ($my_feed) { | |
echo '<link rel="alternate" type="application/rss+xml" title="RSS feed" href="'.$my_feed.'"/>'; | |
} | |
else { | |
feed_links(); | |
} | |
} | |
remove_action( 'wp_head', 'feed_links', 2); // Display the links to the general feeds: Post and Comment Feed | |
add_action('wp_head', 'response_feed_links'); |
Sorry for not being clear in the tweet.
Yes, the `<a href>` around the icon on the page (html body) is just fine.
It allows me to set a custom (feedburner) RSS feed.
The problem is in the HTML `<head>` section, where `<link rel="alternate">`feeds are still the default ones.
This means that a user who subscribes, within his favorite RSS reader, by
entering the blog URL (not a copy/paste of the link attached to the icon)
will get the default feed (automatically detected by the RSS reader, thanks
to the `<link rel="alternate">` ) instead of the custom one.
I hope you understand the benefit from this. I use feedburner to agregate /
analyse my subscriptions. If some end-users catch the default RSS feed,
they bypass feedburner.
Ah I see. Yes that makes a lot of sense, I will go ahead and use your code in our next round of updates. Thank you very much!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for taking the time to write this out, but can I ask what we would gain by adding this function? Our current RSS links including our social icon seem to be just fine.
Thanks.