Jump to content


Photo

hide category from posts


  • Please log in to reply
5 replies to this topic

#1 steelmayhem

steelmayhem

    Super Member

  • Members
  • 120 posts
  • Country: Country Flag

Posted 16 June 2011 - 03:44 PM

How do I hide a category from blog posts? Thanks Mark

#2 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 16 June 2011 - 06:36 PM

http://codex.wordpre..._Your_Home_Page You could add this code using a filter hook in the functions.php file of your child theme. hook location : pagelines_before_theloop

#3 steelmayhem

steelmayhem

    Super Member

  • Members
  • 120 posts
  • Country: Country Flag

Posted 16 June 2011 - 08:49 PM

is this for all? is there a way to hide specified categories? say I have 5 and i dont want one of them.

#4 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 17 June 2011 - 02:27 AM

If you want to one specific category, you can. Just add the category ID for that one category you want to hide (and not any category IDs).

#5 adonnan

adonnan

    Member

  • Members

  • 24 posts
  • Country: Country Flag

Posted 23 January 2012 - 05:03 PM

Please correct me if I'm wrong, but I found this code elsewhere and modified it to filter out a couple categories from my blog and rss feed. // Hide Category from feed // function myFeedExcluder($query) { if ($query->is_feed) { $query->set('cat','-28,-312,-196'); } return $query; } add_filter('pre_get_posts','myFeedExcluder'); // Hide Category from blog // function exclude_category($query) { if ( $query->is_home()) { $query->set('cat', '-28,-312,-196'); } return $query; } add_filter('pre_get_posts', 'exclude_category');

#6 Jenny

Jenny

    Advocate

  • Unicorn Store Dev

  • 2924 posts
  • LocationWV
  • Country: Country Flag

Posted 23 January 2012 - 05:12 PM

This thread is very old so if you have a question, make sure you start a new discussion. Thanks :)