Support » Fixing WordPress » Show a specific category on homepage

  • Resolved syber90


    this is the code that I have in my index.php file;

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

    what should I add to it so I can show on my homepage only posts from category id=3, for example ?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Might look at using Custom Query String Reloaded for that.

    Also, The Loop article discusses excluding posts of a certain category so just change that to exclude all but category 3.

    That might be a solution but it won’t work for me because I won’t be able to order the posts from that specific category the way I want on the homepage.

    That’s why I need to show only category 3 on the homepage and with the help of AStickyPostOrderER plugin I will be able to order them how I want.

    So, I’m looking for a function to display the category 3 on the homepage and not posts from category 3.

    Any help would be appreciated.

    Done it!

    Here’s the code I used:

       if (is_home()) {

    It should be placed before the Loop.

    here’s another hack to show what category you want on homepage

    <?php if (have_posts()) :query_posts($query_string .'&cat=3'); while (have_posts()) : the_post(); ?>

    And if you want to exclude a specific category from homepage, instead of '&cat=3', put '&cat=-3' .

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show a specific category on homepage’ is closed to new replies.