rdusnr

Untitled

Feb 23rd, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1.  
  2. if ( ! function_exists( 'kleo_get_search_menu_item' ) ) {
  3.  
  4. function kleo_get_search_menu_item()
  5. {
  6.  
  7. $context = sq_option('search_context', '');
  8. if (is_array($context)) {
  9. $context = implode(',', $context);
  10. }
  11.  
  12. //Defaults
  13. $action = home_url('/');
  14. $hidden = '';
  15. $input_name = 's';
  16. if (function_exists('bp_is_active') && $context == 'members') {
  17. //Buddypress members form link
  18. $action = bp_get_members_directory_permalink();
  19.  
  20. } elseif (function_exists('bp_is_active') && bp_is_active('groups') && $context == 'groups') {
  21. //Buddypress group directory link
  22. $action = bp_get_groups_directory_permalink();
  23.  
  24. } elseif (class_exists('bbPress') && $context == 'forum') {
  25. $action = bbp_get_search_url();
  26. $input_name = 'bbp_search';
  27.  
  28. } elseif ($context == 'product') {
  29. $hidden .= '<input type="hidden" name="post_type" value="product">';
  30. }
  31.  
  32.  
  33. ob_start();
  34. ?>
  35. <a class="search-trigger" href="#"><i class="icon icon-search"></i></a>
  36. <div class="kleo-search-wrap searchHidden" id="ajax_search_container">
  37. <form class="form-inline" id="ajax_searchform" action="<?php echo $action; ?>"
  38. data-context="<?php echo $context; ?>">
  39. <?php echo $hidden; ?>
  40. <input name="<?php echo $input_name; ?>" class="ajax_s form-control" autocomplete="off" type="text"
  41. value="<?php if (isset($_REQUEST['s'])) {
  42. echo esc_attr($_REQUEST['s']);
  43. } ?>" placeholder="<?php _e("Start typing to search...", "kleo_framework"); ?>">
  44. <span class="kleo-ajax-search-loading"><i class="icon-spin6 animate-spin"></i></span>
  45. </form>
  46. <div class="kleo_ajax_results"></div>
  47. </div>
  48.  
  49. <?php
  50. $form = ob_get_clean();
  51.  
  52. return $form;
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment