Themes and automatic_feed_links

Since WordPress 2.8, there is the function automatic_feed_links() in the function.php. Which writes the link elements for the RSS protocols in the header of the document. The advantage of this feature is, you do not need to worry about whether a change comes in the Feed-protocoll in a new version of WordPress, removed or a new one is added.


If we develop a theme for the general public, you have 2 options. You use automatic_feed_links() and the theme does not work with WordPress prior to version 2.8, or you do not use this function and write the links as before, in your header.php.

I also have a 3rd alternative ;).

if (function_exists('automatic_feed_links')) {
    automatic_feed_links();
} else {
    add_action('wp_head', 'wpe_feed_links', 2);
}

function wpe_feed_links() {
    echo '';
    echo '';
    echo '';
}

First we look if the function automatic_feed_links() exists. If not (prior to WP 2.8), we use the hook wp_head and write the links in the header of the page. Thus we don’t need to adjust the header.php anymore.


Posted

in

,

by

Comments

2 responses to “Themes and automatic_feed_links”

  1. Jacob Fiint Avatar

    Do you have any plans to release your WP Engineer theme? The theme that was currently used in this blog? ๐Ÿ™‚

    I love how the theme was constructed. It’s simple, yet elegant. ๐Ÿ™‚

  2. Michael Avatar

    Thanks Jacob!

    We are lucky too with the design, so no plans at the moment. Maybe later. ๐Ÿ˜‰