background img

Showing only selected posts on front page in WordPress

8 years ago written by
Follow Us on Twitter

Is there any way to make WordPress frontpage show posts from some categories? Yes, there is a it is not complicated if you follow our steps.
To make front page display only selected posts, those posts which you add to specific category (for example “Frontpage” category), you need to edit your theme index file.

1. Create new category, name it “Frontpage”
2. When created, click Edit.
3. Locate the category ID as shown in the picture


4. Navigate to Appearance, then Editor
5. Click Main Index Template
6. Find this line of code

<!--?php if (have_posts()) : while (have_posts()) : the_post(); ?-->

And change to

<!--?php query_posts('cat=4930'); ?-->
<!--?php if (have_posts()) : while (have_posts()) : the_post(); ?-->

7. You added line query_posts(‘cat=4930‘); where 4930 is the category ID.
8. Done

Follow Us on Twitter
Article Tags:
· · · ·
Article Categories:
Tutorials · Wordpress
WordPress Themes with a bang

Leave a Comment

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