-
-
Save jamiemitchell/4735559 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Don't show Events category on homepage | |
* Category 5 = Events category, so we use cat=-5 | |
* | |
* @link http://www.billerickson.net/thesis-wordpress-remove-category-homepage/ | |
* @author Bill Erickson | |
* @param object $query | |
*/ | |
function be_exclude_events_from_home( $query ) { | |
if( $query->is_main_query() && !is_admin() && $query->is_home() ) | |
$query->set( 'cat', '-5' ); | |
} | |
add_action( 'pre_get_posts', 'be_exclude_events_from_home' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment