WP - hide on category

Discussion in 'WordPress' started by roseau, Jul 17, 2007.

  1. #1
    I know this has been answered here but everytime I search nothing comes up so I need to ask.

    I want to hide one category from the list on my home page. I read someone's tutorial and they had a little snippet of code for the myhack.php file BUT it does not work for the current version just released.

    Wordpress itself, says you can hide a category and when I went to the section where the check box is supposed to be, it didn;t exist so I think the option must be been on an older version.

    Anyway, either with code or a plugin, how do I hide one of the categories so people cannot see it on the homepage.

    thx so much for the help.
     
    roseau, Jul 17, 2007 IP
  2. OIOplus

    OIOplus Peon

    Messages:
    233
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do you just want to hide the sidebar link to the category? Or the actual posts from that category appearing on the home page?

    The first option would require you to replace the wp_list_cats() function in the sidebar (X = category ID to hide):

    
    wp_list_cats("exclude=X");
    
    Code (markup):
    And the 2nd would require adding the following code just before "the loop" in your index.php template file (X = category ID to hide):

    
    if(is_home()) query_posts("cat=-X");
    
    Code (markup):
     
    OIOplus, Jul 18, 2007 IP
  3. jhmattern

    jhmattern Illustrious Member

    Messages:
    8,909
    Likes Received:
    794
    Best Answers:
    2
    Trophy Points:
    455
    #3
    I believe there's a plugin called category visibility that does it for you.
     
    jhmattern, Jul 18, 2007 IP