Last active
October 14, 2015 20:54
-
-
Save jesseeproductions/eface479faf403c89784 to your computer and use it in GitHub Desktop.
The Events Calendar - Include Events From Certain Categories on Home Page Main Blog
This file contains hidden or 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
/* | |
* The Events Calendar - Exclude Events From Certain Categories on Home Page Main Blog | |
* add coding to theme's functions.php | |
* @version 3.12 | |
* change convention and meetup to slug of Event Categories to show add new categories by separating by comma and add slug between apostrophes | |
*/ | |
add_action( 'pre_get_posts', 'home_exclude_events_category' ); | |
function home_exclude_events_category( $query ) { | |
if ( $query->is_home() && $query->is_main_query() ) { | |
$query->set( 'tax_query', array( | |
array( | |
'taxonomy' => TribeEvents::TAXONOMY, | |
'field' => 'slug', | |
'terms' => array( 'convention', 'meetup' ), | |
'operator' => 'NOT IN' | |
) | |
) ); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment