Dedicated Locations Search
-
I have been trying to make a Locations search similar to events search. Can you help me out?
I copied events-search and then renamed it to location search.
I modified the locations-list file to make it more similar to Events list.You can find the monstrosity I came up with at the following link: https://gist.github.com/adzay/717a41afa2e32dc0394e
I replaced ‘EM_Events::’ with ‘EM_Locations::’ Hoping it would make the search for locations. But it did not work.
I also saw the following in my location- search file. ‘<input type=”hidden” name=”action” value=”search_events” />’
I changed “search_events” into “search_locations”. And I did this in the locations-list php file aswell.
In the file the following section works because it calls my locations-search.php on top of my locations list.
if( get_option('dbem_events_page_search') && !defined('DOING_AJAX') ){ em_locate_template('templates/locations-search.php',true); }
But when I actually press search it gives me the default Events table instead of results in the locations list format I just sent you.
I found this on line 544 of em-actions in the main plugin directory.
}elseif( $_REQUEST['action'] == 'search_events' && get_option('dbem_events_page_search') && defined('DOING_AJAX') ){ $args = EM_Events::get_post_search(); if( empty($args['scope']) ){ $args['scope'] = get_option('dbem_events_page_scope'); } $args['owner'] = false; ob_start(); em_locate_template('templates/events-list.php', true, array('args'=>$args)); //if successful, this template overrides the settings and defaults, including search echo apply_filters('em_ajax_search_events', ob_get_clean(), $args); exit(); }
I duplicated that and made it for locations:
elseif( $_REQUEST['action'] == 'search_locations' && get_option('dbem_events_page_search') && defined('DOING_AJAX') ){ $args2 = EM_Locations::get_post_search(); if( empty($args['scope']) ){ $args['scope'] = get_option('dbem_events_page_scope'); } $args['owner'] = false; ob_start(); em_locate_template('templates/locations-list.php', true, array('args'=>$args)); //if successful, this template overrides the settings and defaults, including search echo apply_filters('em_ajax_search_events', ob_get_clean(), $args); exit(); }
Doing this gives me an error because it is unable to define EM_Locations::get_post_search();.
Can you guys help me with this please?
- The topic ‘Dedicated Locations Search’ is closed to new replies.