How to Include Custom Post Types on Your WordPress RSS Feeds and Homepage

The prominent feature amongst all the WordPress functionalities is Custom Post Types. This feature was added to the WordPress theme package from its version 3.0. This exceptional feature has helped WordPress in gaining much popularity when compared to other leading Content Management Systems.

In case, if you are planning to utilize the Custom Post Types feature for your WordPress blog posts, then you must definitely add them to your RSS Feed. It’s one such feature that doesn’t come by default when you download the theme. And moreover WordPress by default supports adding posts to the RSS Feed.

In this WordPress tutorial the complete information for adding custom post types to your RSS Feeds is covered.

You must first access the theme’s functions.php file to insert the below mentioned code by finding the PHP markup in code:

RSS Feeds

The code that you have pasted will set ‘Post’ as the default content type for the all blog posts that you add to your RSS Feed. By doing this, your RSS Feed will offer support to different custom post types.

In case, if you encounter a situation wherein you plan to have five custom post types for your latest project and you think to add only three post types to your RSS Feed, then you can do this pretty easily by making slight modifications to the code.

RSS Feeds

If you notice, the code pasted above is a simple array to change or set the desired post_ types that you want to display in your main RSS Feed is clearly highlighted and you must just update it with the desired post types.

Adding Custom Post Types to Homepage:

To add custom post types to home page, you need to add a code snippet to your functions.php file present in your theme package. Copy the code given below and paste it in the functions.php file.


Here’s the complete breakdown of code:

The first line in the code, will add a function to WordPress and automatically names it as ‘custom_conference_in_home_loop’ and the parameters for this function is ‘$query’.

The next line of the code effectively tests whether the user is on home page or not, if the condition is true or satisfies, then the line 3 is executed which sets the post type to an array that makes the standard posts type as the ‘post’.

The query is turned back to line 4and then the function is closed at line 5. The code in line 6 will call the main query with ‘pre_get_posts’ which executes all the theme functions of the code.

Leave a Reply

Your email address will not be published. Required fields are marked *

1000's of Wordpress Templates at Great Prices: Visit ThemeForest