Support » Requests and Feedback » One Category as Index?

  • 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.

    Gdo33

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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).

    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?

    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.

    Well this worked for me. It is suggested right from the codex site.
    The URL is ::
    http://codex.wordpress.org/FAQ_Layout_and_Design#How_do_I_hide_a_category_from_the_front_page_index.php.3F

    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.

    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
    http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘One Category as Index?’ is closed to new replies.