Quantcast
Channel: Two Ells » plugin
Viewing all articles
Browse latest Browse all 2

Custom Feed Links in WordPress

$
0
0

At a WordPress meetup tonight, the question arose of how to override default feed links for a WordPress site. For example, what if you’re using FeedBurner and want to just change the links in your source to the relevant FeedBurner links without hacking your theme? I don’t know if it’s the best way, but it looks like this is pretty easily done with a plugin that, in its simplest form, looks like this:

<?php
function feedme_remove_feed_links() {
        remove_theme_support( 'automatic-feed-links' );
}
add_action ( 'after_setup_theme', 'feedme_remove_feed_links', 11 );

function feedme_add_feed_links() {
?>
<!-- CUSTOM FEEDS HERE -->
<?php
}
add_action( 'wp_head', 'feedme_add_feed_links' );

Of course, you would need to make the feedme_add_feed_links() function do something a bit more useful, and in an ideal world, you’d provide an admin screen that allows people to specify their links.

One important detail that may not jump out at you is that when adding the “after_setup_theme” action, you need to give it a priority higher than 10. Else it just goes into a stack with all other of its sibling actions with the default priority and may be (in fact seems to be) overridden by one of them.


Tagged: code, dev, plugin, wordpress, work

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images