Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #306628

    Hey Guys – I’d like to be able to exclude some categories from the main blog page – loooong story but I need to exclude it from the single.php, is there a way to do this in the funciotions or the child theme?

    Cheers

    #306705

    Hi ShortieD!

    Please add following code to Functions.php file in Appearance > Editor

    function exclude_category_blog($query) {
    if ( $query->is_home() ) {
    $query->set('cat', '-33');
    }
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category_blog');

    and change 33 with category ID you would like to hide – http://wordpress.org/support/topic/how-to-find-out-category-id-number

    Regards,
    Yigit

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.