Custom post types is a great a feature introduced in WordPress 3.0 and it extended the functionality and practical usage of this awesome CMS. While re-designing / re-structuring CSSJockey.com, I have used Custom Post Types for different sections on this website.

Now I want to add all these custom post types to main WordPress feed so the users get updated content from each section via RSS. There are two ways we can do that. You can add the below code snippets to the [htmltag tag=’code’]functions.php[/htmltag] file of your theme.

1. Add all Custom Post Types to Main WordPress RSS Feed

The code below will add all registered custom post types to main WordPress RSS feed.

Function  [htmltag tag=’code’ class=”]get_post_types()[/htmltag] will return all registered custom post types. Here you can learn more about get_post_types() function.

2. Add selected Custom Post Types to Main WordPress RSS Feed

I’ve used woocommerce plugin for the shop section of this website and this plugin added a few more custom post types which may be not relevant or useful for my readers. So with the code snippet below we can add a few selected Custom Post Types to main WordPress RSS Feed.

If you notice, here instead of using [htmltag tag=’code’ class=”]get_post_types()[/htmltag] function, I supplied an array of specific custom post types slugs. This will add content to WordPress main RSS feed only from the specified post types.

 
  • Fred – FLQ

    Thank you for this snippet : working like a charm. 😉

    I found it on some other websites but I really enjoy the design, feeling & the wonderful attention paid to details in CSSJockey ! Just got your feed in my reader and can’t wait to see what you have in store for us next (especially the WordPress Whiz Course !).

    Fred 😀