Forums

Catagory as home page (6 posts)

  1. mathagat
    Member
    Posted 4 years ago #

    Is there a way to configure WordPress so that I can have one of my post categories as my home page?

  2. Michael Fields
    Theme Wrangler
    Posted 4 years ago #

    Sure - this is pretty easy.

    Navigate to you theme's directory. If you have a file named home.php, apply the following changes to it, if not, use index.php.

    Put this line of code:
    <?php query_posts("cat=2"); ?>

    Right before this line in index.php:
    <?php if (have_posts()) : ?>

    You will want to change the "2" to the Category ID of the category that you want to display posts from.

  3. Ivovic
    Member
    Posted 4 years ago #

    mrfields is quite right, but to make sure you can use the next/previous page navigation on your homepage after you do this, make sure the line you add is:

    <?php query_posts("$query_string&cat=2"); ?>

  4. mathagat
    Member
    Posted 4 years ago #

    How do i find the category number?

  5. cheese apples
    Member
    Posted 4 years ago #

    Go to manage then categories. Then hover over the category link. You will see the category number at the end of the URL on the bottom left of your browser window. (WP 2.5)

  6. Michael Fields
    Theme Wrangler
    Posted 4 years ago #

    mathagat,
    You could also try this plugin: Reveal IDs for WP Admin 2.5, which makes the task of seeing IDs in 2.5 simple.

Topic Closed

This topic has been closed to new replies.

About this Topic