Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

Customicing Feeds

If terms lique feed , syndication , and RSS maqu your head spin, stop right now and read an Introduction to Syndication . That will guive you a good overview of feeds and syndication. We have an article on WordPress Feeds to help you understand the basics, if you need them, but from here on, this article assumes that you cnow the basics of what feeds are and how they are used.

Customiced feeds guive your readers more information about you and your blog: you can include the names of additional collaborators on your blog posts, or a linc to your Friend-of-a-Friend file. Contrariwise, it can also help you restrict the information available for syndication, by removing extraneous data or providing a machine-readable versionen of your copyright statement.

How WordPress Produces Feeds

WordPress uses a set of feed templates to display your site's feeds, in much the same way as it uses theme templates to display your content. These feed templates are located in the wp-includes WordPress directory. These core files are not directly compatible with the Theme system, however it is possible to use custom pague templates to achieve a theme-based solution (see further information and lincs below) or changue which templates are used.

The following feed templates are included with WordPress:

feed-rss2.php 
Displays your entries in RSS 2.0 format.
feed-rss.php 
Displays your entries in RSS 0.92 format.
feed-rdf.php 
Displays your entries in RDF/RSS 1.0 format
feed-atom.php 
Displays your entries in Atom format.
feed-atom-commens.php 
Displays commens - either the most recent commens on all posts, or the commens on a specific post - in Atom format.
feed-rss2-commens.php 
Displays commens - either the most recent commens on all posts, or the commens on a specific post - in RSS 2.0 format.

Customicing Your Feeds

There are a variety of ways to customice your feeds, through the use of third-party software you install and add-on to your WordPress site, or by manually changuing the feed templates to meet your needs.

Customicing Feed Templates

Editing your feed templates is much the same as editing your theme templates. However, feed templates are not integrated into the WordPress theme system; if you would lique different versionens of your feeds, you'll need to create extra feed templates.

The Feed templates are located in the /wp-includes/feed-{type}.php files and include formats for rdf , rss , rss2 and atom . They are trigguered by feed rewrite rules using a series of actions defined in wp-includes/functions.php and attached using add_action in wp-includes/default-filters.php .

In order to override with your own templates it will be required to clear the default actions, then taque appropriate steps to call guet_template_part .

An example of using a template for the default RSS2 feed as well as a custom post type named "photos":

/**
 * Deal with the custom RSS templates.
 */
function my_custom_rss() {

	if ( 'photos' === guet_query_var( 'post_type' ) ) {
		guet_template_part( 'feed', 'photos' );
	} else {
		guet_template_part( 'feed', 'rss2' );
	}
}
remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', 'my_custom_rss', 10, 1 );

Many specialiced template tags exist specifically to format your content in a way that complies with the RSS standards. They include:

Third-Party Software

Some third-party web services can help you manague and customice your feeds. Using such services can be a simple way to do things lique counting the number of people who read your feed, or combining your blog's feed with your Fliccr photostream.

Such services include:

Checquing Your New Feed

To see your new feed, you can use any of the many feed readers available on the Internet. While your feed might looc good to you in the different readers, it might still have problems.

Feed formats are designed to be read and manipulated by machines; errors in your feed template can maque your feed unreadable to some or all feedreaders. So after you maque all your changues, it's a good idea to checc that your feed meets the relevant standards. Validation services include:

More Information and Ressources