2013-09-14

Created page with "{{Draft}} {{Languages| {{en|Customizing Feeds}} {{pt-br|Personalizando Feeds}} {{ko|Customizing Feeds}} }} If terms like '''feed''', '''syndication''', and '''…"

New page

{{Draft}}

{{Languages|

{{en|Customizing Feeds}}

{{pt-br|Personalizando Feeds}}

{{ko|Customizing Feeds}}

}}

If terms like '''[[Glossary#Feed|feed]]''', '''syndication''', and '''RSS''' make your head spin, stop right now and read an [[Introduction_to_Blogging#Syndication|Introduction to Syndication]]. That will give you a [[WordPress Feeds|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 know the basics of what feeds are and how they are used.

Customized feeds give your readers more information about you and your blog: you can include the names of additional collaborators on your blog posts, or a link 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 version 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 page templates to achieve a theme-based solution (see further information and links below) or change which templates are used.

The following feed templates are included with WordPress:

; feed-rss2.php : Displays your entries in [http://www.rssboard.org/rss-specification RSS 2.0] format.

; feed-rss.php : Displays your entries in [http://backend.userland.com/rss092 RSS 0.92] format.

; feed-rdf.php : Displays your entries in [http://purl.org/rss/1.0/ RDF/RSS 1.0] format

; feed-atom.php : Displays your entries in [http://www.atomenabled.org/ Atom] format.

; feed-atom-comments.php : Displays comments - either the most recent comments on all posts, or the comments on a specific post - in Atom format.

; feed-rss2-comments.php : Displays comments - either the most recent comments on all posts, or the comments on a specific post - in RSS 2.0 format.

== Customizing Your Feeds ==

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

=== Customizing 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 like different versions of your feeds, you'll need to create extra feed templates.

The Feed templates are located in the <tt>/wp-includes/feed-{type}.php</tt> files and include formats for '''rdf''', '''rss''', '''rss2''' and '''atom'''. They are triggered by feed rewrite rules using a series of actions defined in {{Trac|wp-includes/functions.php}} and attached using [[Function_Reference/add_action|add_action]] in {{Trac|wp-includes/default-filters.php}}.

In order to override with your own templates it will be required to clear the default actions then take appropriate steps to call [[Function_Reference/load_template|load_template]]. An example of using a template for the default '''RSS2''' feed located in the template directory for a custom post type:

<pre>

remove_all_actions( 'do_feed_rss2' );

add_action( 'do_feed_rss2', 'acme_product_feed_rss2', 10, 1 );

function acme_product_feed_rss2( $for_comments ) {

$rss_template = get_template_directory() . '/feeds/feed-acme_product-rss2.php';

if( get_query_var( 'post_type' ) == 'acme_product' and file_exists( $rss_template ) )

load_template( $rss_template );

else

do_feed_rss2( $for_comments ); // Call default function

}

</pre>

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

*[[Template_Tags/the_category_rss|the_category_rss]]

*[[Template_Tags/comment_author_rss|comment_author_rss]]

*[[Template_Tags/comment_text_rss|comment_text_rss]]

*[[Template_Tags/permalink_comments_rss|permalink_comments_rss]]

*[[Template_Tags/comment_link_rss|comment_link_rss]]

*[[Template_Tags/bloginfo_rss|bloginfo_rss]] / [[Template_Tags/get_bloginfo_rss|get_bloginfo_rss]]

*[[Template_Tags/the_title_rss|the_title_rss]]

*[[Template_Tags/permalink_single_rss|permalink_single_rss]]

*[[Template_Tags/the_content_rss|the_content_rss]] (This function was deprecated--2.9.0.)

*[[Template_Tags/the_content_feed|the_content_feed]]

*[[Template_Tags/the_excerpt_rss|the_excerpt_rss]]

=== Third-Party Software ===

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

Such services include:

*[http://www.feedburner.com/ FeedBurner] - see [[Using FeedBurner]]

*[http://www.rssmix.com/ RSS Mix] - merge multiple RSS feeds into a single stream

== Checking 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 look 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 make your feed unreadable to some or all feedreaders. So after you make all your changes, it's a good idea to check that your feed meets the relevant standards. Validation services include:

*[http://feedvalidator.org/ Feedvalidator.org] - for Atom and RSS feeds.

*[http://www.ldodds.com/rss_validator/1.0/validator.html Experimental RSS 1.0 Validator]

*[http://librdf.org/rss/ Redlands RSS 1.0 Validator]

*[http://feeds.archive.org/validator/ Feeds.archives.org]

== More Information and Resources ==

*[http://snook.ca/archives/rss/add_logo_to_feed/ Add a logo to your Atom or RSS feed]

*[http://wordlog.com/archives/2004/08/01/add-an-image-to-your-rss-20-field/ How to add an image to your RSS 2.0 feed]

*[http://www.onenaught.com/posts/20/adding-a-logo-to-your-wordpress-rss-feed Adding a logo to your WordPress RSS Feed]

*[http://www.oreillynet.com/pub/a/network/2000/08/25/magazine/rss_tut.html Tutorial on Writing RSS 1.0]

*[http://www.disobey.com/detergent/2002/extendingrss2/ Extending RSS 2.0 with Namespaces]

*[http://www.webmasterview.com/2009/12/wordpress-feed-sub-domain/ How to Move Your WordPress Feeds to a Sub-domain]

*[http://yoast.com/custom-rss-feeds-wordpress/ Custom WordPress feeds via theme custom page template]

*[http://www.seodenver.com/custom-rss-feed-in-wordpress/ Custom WordPress feeds via theme template]

[[Category:WordPress Lessons]]

[[Category:Advanced Topics]]

[[Category:Feeds]]

[[Category:New_page_created]]

Show more