One Category as Index? (6 posts)

  1. Gdo33
    Posted 10 years ago #

    I am hoping that some one can help me with might be a simple solution. For a site that has say 10 categories yet one is the main subject, how can i set index.php/my home page....to show posts only from that one category?

    I know a simple re-direct can work normally but I am completely new to the wordpress enironment and i am thinking there mey be more to it.

    I am a sports blog but do write about music and other things here and there. I would prefer that those posts show on their category pages and have only sports posts shows on my home page.

    Thanks in advance for any replies.


  2. monkeypup
    Posted 10 years ago #

    Easy peasy, man. Go get the plugin called opt-in front page from Semiologic.com. Then, you can decide what posts go to the front page by assigning them a category you decide (the default category for the plugin is blog).

  3. ZAGG
    Posted 10 years ago #

    Thanks monkeypup I was looking for something like this. But when the plug-in hides also the sidebar when I go to the other categories. Do you know how to fix it?

  4. monkeypup
    Posted 10 years ago #

    Not sure, Zagg. I'd suggest you contact Denis (the plugin's designer). He's a great guy (who makes amazing plugins and a great theme) and can probably point you in the right direction.

  5. evL
    Posted 10 years ago #

    Well this worked for me. It is suggested right from the codex site.
    The URL is ::

    So basically enable my-hacks.php support in:
    Options / Miscellaneous / Use legacy my-hacks.php file support.

    Then make or edit your my-hacks.php file which needs to be in the wordpress root and add this line:
    if ((empty($_GET['cat']))&&(!preg_match('/wp-admin/', $_SERVER['REQUEST_URI']))) $cat = '-1';
    //Replace 1 with your category

    What I wanted was only one category to show on the front page so I have this line repeated about six times and replaced the "1" above with the nubers 2 thru 7 in each instance of the line. This keeps categories 2 thru 7 off the front page.


  6. Jaycos
    Posted 10 years ago #

    forget about all plugins and simply enter this into your index.php or home.php somewhere before the loop starts:

    <?php query_posts('cat=3'); ?>

    This is to display posts from category-ID 3 only. For more parameters see

Topic Closed

This topic has been closed to new replies.

About this Topic