Support » Fixing WordPress » Specific Category on Home page

  • Hi Everyone,

    On a new WordPress site, the Home page is set to ‘recent posts’ – I would like it to display posts from a specific category ONLY. I know I could set a menu item up that is associated with a specific category and call that the Home page but then I would lose the home page template design. Is there a way to just set the Home page to display posts from a specific category only?

    Thanks for any input!
    Judi

Viewing 1 replies (of 1 total)
  • Yes, it’s a very common question, you can get many solution by googling it.
    Anyways, it’s a query_posts() function, you need to use for it in your theme’s index.php.

    <?php
    //it will query for a category which id is 3 and display only 5 posts of that category
    query_posts( 'cat=3&showposts=5' );
    while ( have_posts() ) : the_post()
    ?>

    and after content template
    <?php end while; ?>

    to show a specific quantity of posts (i.e. 5) of that category use:
    query_posts( 'cat=3&showposts=5' );

    P.S.: You can see category ID by hovering your mouse on any category in Posts > Categories in admin panel.

Viewing 1 replies (of 1 total)
  • The topic ‘Specific Category on Home page’ is closed to new replies.