I have a custom site that uses The Events Calendar to manage Events. I have a search in my main nav and I am unable to show events, only posts and pages. I have added custom filters but I know I am just overlooking something.
Here are the functions found in my theme's function.php
add_theme_support('html5' ,array('search-form'));
add_filter('wp_nav_menu_items', 'add_search_form', 10, 2);
function add_search_form($items, $args) {
if( $args->theme_location == 'menu-top' )
$items .= '<li class="search"><form role="search" method="get" id="searchform" action="'.home_url( '/' ).'">
<input type="search" class="search-box" placeholder="Type Here" name="s" />
<input class="search-button" type="submit" id="searchsubmit" value="'. __('Search') .'" /></form>
</li>';
return $items;
}
//Define what post types to include in search
function include_in_search( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array( 'post', 'page', 'feed', 'tribe_events' ));
}
return $query;
}
add_filter('the_search_query', 'include_in_search' );
I sure would appreciate a hand in this. Thanks in advance.