-
-
Save Pebblo/24791195c24b868c88ad0ee217906b96 to your computer and use it in GitHub Desktop.
Example of how to exclude specific event ID's from the front end event lists.
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 //Please do not include the opening PHP tag if you already have one | |
function tw_ee_exclude_events_from_front_end($wp_query) { | |
if( is_admin() ){ | |
return; | |
} | |
if ( isset( $wp_query->query_vars['post_type'] ) | |
&& ( $wp_query->query_vars['post_type'] == 'espresso_events' || ( is_array( $wp_query->query_vars['post_type'] ) && in_array( 'espresso_events', $wp_query->query_vars['post_type'] ) ) ) | |
&& ! $wp_query->is_singular | |
) { | |
$wp_query->set('post__not_in', array(58, 11, 1911)); | |
} | |
} | |
add_action('pre_get_posts', 'tw_ee_exclude_events_from_front_end'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment