Enough people loved this gist, so it's now a Github repository!
⭐ Please use the "The Events Calendar Reset" on Github going forward. ⭐
Enough people loved this gist, so it's now a Github repository!
⭐ Please use the "The Events Calendar Reset" on Github going forward. ⭐
| /*-----------------------------------------------------------------------------------*/ | |
| /* The Events Calendar - Conditional Logic to Detect Various Event Related Views/Pages | |
| /*-----------------------------------------------------------------------------------*/ | |
| if ( tribe_is_month() && ! is_tax() ) { // Month View Page | |
| echo 'were on the month view page'; | |
| } elseif ( tribe_is_month() && is_tax() ) { // Month View Category Page |
| /* =BEGIN: Check If Page Is Child | |
| Source: http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/ | |
| ---------------------------------------------------------------------------------------------------- */ | |
| function is_child( $page_id_or_slug ) { // $page_id_or_slug = The ID of the page we're looking for pages underneath | |
| global $post; // load details about this page | |
| if ( !is_numeric( $page_id_or_slug ) ) { // Used this code to change a slug to an ID, but had to change is_int to is_numeric for it to work. | |
| $page = get_page_by_path( $page_id_or_slug ); | |
| $page_id_or_slug = $page->ID; | |
| } |
| add_action( 'pre_get_posts', 'custom_pre_get_posts_query' ); | |
| function custom_pre_get_posts_query( $q ) { | |
| if ( ! $q->is_main_query() ) return; | |
| if ( ! $q->is_post_type_archive() ) return; | |
| if ( ! is_admin() && is_shop() ) { | |
| $q->set( 'tax_query', array(array( |