Education Theme Blog Home Page – do not show category

Community Forums Forums General Discussion Education Theme Blog Home Page – do not show category

This topic is: resolved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Susan 4 months ago.

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

    bhardwick
    Member
    Post count: 4

    I have an education theme site that I wanted to NOT show 1 blog category on the home page. The “exclude category id” under Genesis > Theme Settings – Blog Page Template was not working, so here is what I did to make it work.

    In functions.php add the following code

    /** Exclude certain category from posts */
    add_action( ‘pre_get_posts’, ‘be_exclude_category_from_blog’ );
    function be_exclude_category_from_blog( $query ) {

    if( $query->is_main_query() && $query->is_home() ) {
    $query->set( ‘cat’, ‘-101′ );
    }
    }

    The 101 is the category to exclude.

    http://www.gcak12.org
    #97423

    Susan
    Moderator
    Post count: 7991

    You’ve marked this thread as “resolved”, so I will go ahead and close it. If it is not resolved, please start another thread. Thanks!


    Susan @ Graphically Designing I’d love to customize your website! I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Education Theme Blog Home Page – do not show category’ is closed to new replies.