Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'init', 'tribe_fix_homepage', 11, 1 );
- function tribe_fix_homepage() {
- remove_action( 'parse_request', array( 'TribeEventsQuery', 'parse_request' ), 50 );
- add_action( 'parse_query', 'tribe_fix_homepage_query' );
- }
- function tribe_fix_homepage_query( $query ) {
- if ( $query->is_main_query() && is_home() ) {
- // check option for including events in the main wordpress loop, if true, add events post type
- if ( tribe_get_option( 'showEventsInMainLoop', false ) ) {
- $query->query_vars['post_type'] = isset( $query->query_vars['post_type'] ) ? (array) $query->query_vars['post_type'] : array( 'post' );
- $query->query_vars['post_type'][] = TribeEvents::POSTTYPE;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement