• Resolved ariane98

    (@ariane98)


    Hi I love Events manager but I have a question
    I noticed that events were not found by my search box so I added a function :
    `
    function rc_add_cpts_to_search($query) {
    // Check to verify it’s search page
    if( is_search() ) {
    // Get post types
    $post_types = get_post_types(array(‘public’ => true, ‘exclude_from_search’ => false), ‘objects’);
    $searchable_types = array();
    // Add available post types
    if( $post_types ) {
    foreach( $post_types as $type) {
    $searchable_types[] = $type->name;
    }
    }
    $query->set( ‘post_type’, $searchable_types );
    }
    return $query;
    }
    add_action( ‘pre_get_posts’, ‘rc_add_cpts_to_search’ );
    ?>

    Now events are found like other posts BUT the results page have no navigation bar
    I reckon this is not a bug from events manager, but I guess there must be an simple way to solve this issue ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    Which search function are you trying to use? The built-in Events Manager search or the main WordPress search function?

    Thread Starter ariane98

    (@ariane98)

    Hi
    I want to search in the whole site, and retrieve any post, page, event…containing the keyword so I use the WordPress search function, with the custom “add-on” mentioned ealier, called function rc_add_cpts_to_search($query)

    Is there a way of using the built-in Events Manager search to retrieve any post, not only events ?

    No, but it will work the other way around so that events are included in the main WordPress search function. Just set “Include in WordPress Searches” to Yes under Events > Settings > Pages Event List/Archives.

    Thread Starter ariane98

    (@ariane98)

    OK…so it was that simple…
    Thanks a lot !

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Searching events’ is closed to new replies.