Advertisement
eventsmanager

custom templates/search.php

Oct 7th, 2024
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. <?php
  2. /* WARNING!!! (2013-07-10) We intend to add a few more fields into this search form over the coming weeks/months.
  3. * Overriding shouldn't hinder functionality at all but these new search options won't appear on your form!
  4. */
  5. /*
  6. * By modifying this in your theme folder within plugins/events-manager/templates/events-search.php, you can change the way the search form will look.
  7. * To ensure compatability, it is recommended you maintain class, id and form name attributes, unless you now what you're doing.
  8. * You also have an $args array available to you with search options passed on by your EM settings or shortcode
  9. */
  10. /* @var $args array */
  11. if( empty($args['id']) ) $args['id'] = rand(100, getrandmax()); // prevent warnings
  12. $id = esc_attr($args['id']); // id of form for unique selections
  13. $show_advanced = !empty($args['show_advanced']);
  14. //em_template_classes('search', 'modal,search-advanced');
  15. ?>
  16. <div class="<?php em_template_classes('search'); ?> <?php echo esc_attr(implode(' ', $args['css_classes'])); ?>" id="em-search-<?php echo $id; ?>" data-view="<?php echo esc_attr($args['view']); ?>">
  17. <form action="<?php echo !empty($args['search_url']) ? esc_url($args['search_url']) : EM_URI; ?>" method="post" class="em-search-form" id="em-search-form-<?php echo $id; ?>">
  18. <input type="hidden" name="action" value="<?php echo esc_attr($args['search_action']); ?>">
  19. <input type="hidden" name="view_id" value="<?php echo esc_attr($args['id']); ?>">
  20. <?php if( $args['show_main'] ): //show the 'main' search form ?>
  21. <?php em_locate_template('templates/search/form-main.php', true, array('args' => $args)); ?>
  22. <?php else: ?>
  23. <input type="hidden" name="view" value="<?php echo !empty($args['view']) ? esc_attr($args['view']) : esc_attr(get_option('dbem_search_form_view')); ?>">
  24. <?php endif; ?>
  25. <?php if( $show_advanced ): ?>
  26. <?php if( $args['advanced_mode'] == 'inline' ): //show inline if requested ?>
  27. <?php em_locate_template( 'templates/search/form-advanced-inline.php', true, array('args' => $args) ); ?>
  28. <?php else: // Search Form Pop-Up Shown as separate form ?>
  29. <?php em_locate_template( 'templates/search/form-advanced-modal.php', true, array('args' => $args) ); ?>
  30. <?php endif; ?>
  31. <?php endif; ?>
  32. <?php do_action('em_search_form_footer', $args); ?>
  33. </form>
  34. </div>
  35.  
  36. <?php if( empty($args['has_view']) ): // if called by another shortcode e.g. events_list, then that shortcode should generate the search form and wrap itself in the below ?>
  37. <div class='<?php em_template_classes('view-container'); ?> <?php echo esc_attr(implode(' ', $args['css_classes'])); ?>' id="em-view-<?php echo $id; ?>" data-view="<?php echo esc_attr($args['view']); ?>"><?= do_shortcode('[events_list]') ?></div>
  38. <?php endif; ?>
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement