Support » Plugin: Events Manager » Event Search form In Sidebar?

Viewing 11 replies - 1 through 11 (of 11 total)
  • If there is a built in option to put search in the sidebar within Events Manager I haven’t been able to find it.

    I created a custom Events Search Widget. I’m using it in functions.php, but it could also go into a custom plugin.

    It is useful to create custom templates for events-search.php, scope.php, and other search templates so they look better in the sidebar.

    maybe you can try to use wordpress plugin to enable shortcode in Text widget and then use EM shortcode [event_search_form ajax=1]

    Thanks, the sidebar widget is works, so I imagine a shortcode plugin would work as well. However, the ajax functionality does not work from the sidebar. It looks like it is attempting to apply the ajax functions to the sidebar content rather than the main content.

    The shortcode wasn’t expected to be used in a widget as that’s not something WP allows as standard so it may be that the required javascript isn’t loaded.

    Do you see any Javascript errors when trying to use the widget?


    My widget is calling the shortcode like this:

    echo do_shortcode(‘[event_search_form ajax=1]’);

    The ajax is actually working, but it inserts the results into the sidebar, rather than the main window. There must be a simple tweek to the javascript to tell it which div to ajaxify. I’m not sure where that is or how to adjust it.

    The AJAX search function targets em-search-wrapper but as far as I know there’s no way to override that without hacking core files.

    Where is the JavaScript that runs the search? I could deregister it and register a new version that targets the content area.

    have you tried to just use [event_search_form] ?

    Yes it looks like the search function targets the .em-search-wrapper and outputs the results into: .em-search-ajax.

    I hoped it would be as simple as adding those classes into some divs in my template’s main content area, but that doesn’t work.

    However, since [event_search_form] is functional without ajax in the sidebar widget I will leave it at that.


    When I changed the shortcode to: [event_search_form], now the ajax is working. It inserts the search results into my main page template where I have added:

    <div class="em-search-wrapper">
    <div class="em-search-ajax">

    I am curious if this will interfere in cases when the search form is also included in the page, or if the ajax function just targets the first “.em-search-ajax” class that it finds.


    Yes it works! I just had to add the “.em-search-ajax” class to my theme’s ‘post_class’ function. Now the ajax replaces whatever content is in the page with the search results. “.em-search-wrapper” is not necessary.

    In functions.php:

    function em_search_post_class($classes) {
    $classes[] = 'em-search-ajax';
    return $classes;
    add_filter('post_class', 'em_search_post_class');

    The .em-search-ajax snippit from above is breaking event and category pagination.

    When clicking page 2 for example it tries to load the next page with ajax and fails to an empty page. (Not a white screen.)

    Back to the drawing board, for now I will disable ajax in the search sidebar widget, since it works fine without it.

    I hope the Events Manager developers release a sidebar search in a future update.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Event Search form In Sidebar?’ is closed to new replies.