Support » Fixing WordPress » How to hide multiple categories on home

  • I have 4 categories and all posts from these categories are on main page. But I just want to display posts from one particular category. How should I do it? . I have searching this forum but could not get any solution. Any help would be appreciated.
    Thank you (d’apr├ęs perfeclover)

Viewing 8 replies - 1 through 8 (of 8 total)
  • I’m also curious about how you do this.

    Where you work through the posts (the loop), usually in the index.php of your theme, you can check for every post if it is in a certain category and display it only then.

    http://codex.wordpress.org/Template_Tags/in_category

    Hi I want to do the oposite.

    I have one catagory that I want to hide from all sidebare and the index page (I’ll create a link directly to it).

    How do I do that?
    Where do I place the code?

    J;-)

    Use NOT in_category() (in php it looks like if (!in_category('1')) { do it } for the main page (index.php) and for the categories overview, use the following:

    http://codex.wordpress.org/Template_Tags/wp_list_cats#Categories_With_Excludes

    That usally happens in sidebar.php.

    This line works on wp 1.5, bit not on 2.x and it seems that is just for one category and you cannot duplicate it several times, in order to hide multiple categories, but maybe it’s an Enlightenment

    <?php
    if (is_home()) {
    query_posts(“cat=-3”);
    }
    ?>

    Is it possible for someone to post an actual example of a category exclusive loop. I’ve read this and other thread, and attempted to create a category specific loop based on the information, but I am having no success.

    TIA

    I have tried what bob58 recommended but am not sure exactly how the code is written or where it’s placed, can anyone clarify or show an example? I’m trying to exclude one Catagory from showing up in the Sidebar. Thanks

    I found a way to do this. The ID number of the Category that I don’t want to show up in my Sidebar is 3. In my Sidebar.php file, there is this line of code:

    <?php wp_list_cats(‘sort_column=name&optioncount=1&hierarchical=0’); ?>

    I added exclude=3 to it and you get this:

    <?php wp_list_cats(‘sort_column=name&optioncount=1&hierarchical=0&exclude=3’); ?>

    Works perfectly, hope this help, cya

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to hide multiple categories on home’ is closed to new replies.