Use category blacklist for main posts only

Viewing 4 posts - 1 through 4 (of 4 total)
  • #5412
    jackie_sk
    Participant

    I would like to use the blacklist option to prevent a category from showing up in the main section posts on the front page, but still have the post / category show up in the sidebar. I am using the following plug-in to generate the posts on the sidebar: AK: Featured Post Sidebar Widget.

    Right now, either the post shows in the main section and in the sidebar, or, if I blacklist it, it doesn’t show either place.

    • This topic was modified 12 years, 6 months ago by jackie_sk.
    #5463
    Daniel Tara
    Keymaster

    In functions.php find the function esplanade_ignore_sticky_posts() and rewrite it like this:

    function esplanade_ignore_sticky_posts( $query ) {
    	global $wp_the_query;
    	if( ( $wp_the_query === $query && $query->is_home() ) {
    		if( esplanade_get_option( 'slider' ) )
    			$query->set( 'ignore_sticky_posts', 1 );
    		$query->set( 'cat', '-1,-2,-3' );
    	}
    }

    Replace the numbers with the IDs of the categories you wish to exclude.

    #5486
    jackie_sk
    Participant

    I was able to get around this by using the Ultimate Category Excluder plug in. It allows specification of where you want to exclude the category. Thanks for your response. The website based on the theme has gotten good feedback.

    #5530
    jackie_sk
    Participant

    I ended up using this– fyi- it has an extra paren.

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

You must be logged in to reply to this topic.