eventsmanager

Adding tag filter at Events Search Form

Feb 21st, 2013
604
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*ADDING TAG SEARCH FILTER*/
  2.  
  3. 1. create folders plugins/events-manager/templates within your current theme
  4.  
  5. 2. copy template files events-search.php and events-list.php from /wp-content/plugins/events-manager/templates/templates to your newly created folders within your theme
  6.  
  7. 3. edit template file /wp-content/themes/your-current-theme/plugins/events-manager/templates/events-search.php
  8.  
  9. INSERT THIS SNIPPET
  10. <?php
  11. $selected = !empty($_REQUEST['search-tag']) ? $_REQUEST['search-tag'] : 0;
  12. wp_dropdown_categories(array( 'hide_empty' => 0, 'name' => 'search-tag', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_TAG, 'selected' => $selected, 'show_option_none' => 'All Tags', 'class'=>'em-events-search-tag', 'orderby' =>'name'));
  13. ?>
  14.  
  15. BELOW
  16. <?php if( get_option('dbem_search_form_categories') ): ?>
  17. <!-- START Category Search -->
  18. <?php
  19. $selected = !empty($_REQUEST['category']) ? $_REQUEST['category'] : 0;
  20. EM_Object::ms_global_switch(); //in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
  21. wp_dropdown_categories(array( 'hide_empty' => 0, 'orderby' =>'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected, 'show_option_none' => get_option('dbem_search_form_categories_label'), 'class'=>'em-events-search-category'));
  22. EM_Object::ms_global_switch_back(); //if switched above, switch back
  23. ?>
  24. <!-- END Category Search -->
  25. <?php endif; ?>
  26.  
  27.  
  28. 4. edit template file /wp-content/themes/your-current-theme/plugins/events-manager/templates/events-list.php
  29.  
  30. INSERT THIS SNIPPET
  31. if ( $_REQUEST['search-tag'] != '-1' ){
  32. $args['tag'] = $_REQUEST['search-tag'];
  33. }
  34.  
  35. BELOW
  36. em_locate_template('templates/events-search.php',true);
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×