Skip to content
Web Design | Social Media | Print | Marketing & More
Google Guide in Fairfield, Connecticut
Call Us! 1-203-209-6585

How to Limit Posts to a Specific Category on Home Page in WordPress

In WordPress, you have two options for your home page (aka Front page displays); it can be Your latest posts or A static page (which you can specify).

Reading Settings

But what if you want to include posts from only a specific category?  Here is what you need to do:

First find the number associated with the Category that you want to include.  Go to Posts > Categories.  Click on the Category that you want to include. Now look at the URL and find the number after: “tag_ID=

Next, you need to insert some code in the index.php file found in your theme folder.

Find the line that reads:

<!--?php if (have_posts()) : ?-->

and add the following code immediately after:

<!--?php  if ( is_home() ) { $include_cats = '12'; // the number of the category you only want to display on your home page. query_posts('cat='.$include_cats); } ?-->