
In the most recent post of our Web Development series, we discussed specifying feeds for browsers to discover. Today, we’ll be going over how to easily do this with WordPress themes, using some built-in functionality.
In some portions of WordPress, there may be multiple feeds that apply to one page. The two main feeds are the posts feed and the comments feed. When you’re visiting a post or page with comments enabled, a feed of comments on that post is available. There are also feeds available for categories and tags.
As you can imagine, ensuring you are specifying these feeds to the browser when appropriate can get complicated. Beginning in WordPress 2.8, a simply way to achieve this has been available. The function that allows us to do this is automatic_feed_links(). This function will output the appropriate feed specifications to the wp_head of your theme, taking all the guess work out of doing this manually.
To implement this, you must first ensure that you have a wp_head() call in the head of your theme. Otherwise, this method will not work. Then, all you have to do is add a call to automatic_feed_links() in your theme’s functions.php file (don’t forget the opening PHP tag if this file is blank current). Then viola, you will have feed links placed in your theme automatically.




