Advertisement
Guest User

Untitled

a guest
Sep 10th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <?php
  2. if ( !defined('ABSPATH') ){ die(); }
  3.  
  4. global $avia_config;
  5.  
  6.  
  7. //allows you to modify the search parameters. for example bbpress search_id needs to be 'bbp_search' instead of 's'. you can also deactivate ajax search by setting ajax_disable to true
  8. $search_params = apply_filters('avf_frontend_search_form_param', array(
  9.  
  10. 'placeholder' => __('Search','avia_framework'),
  11. 'search_id' => 's',
  12. 'form_action' => home_url( '/' ),
  13. 'ajax_disable' => false
  14. ));
  15.  
  16. $disable_ajax = $search_params['ajax_disable'] == false ? "" : "av_disable_ajax_search";
  17.  
  18. $icon = av_icon_char('search');
  19. $class = av_icon_class('search');
  20. ?>
  21.  
  22.  
  23. <form action="<?php echo $search_params['form_action']; ?>" id="searchform" method="get" class="<?php echo $disable_ajax; ?>">
  24. <div>
  25. <input type="submit" value="<?php echo $icon; ?>" id="searchsubmit" class="button <?php echo $class; ?>" />
  26. <input type="text" id="s" name="<?php echo $search_params['search_id']; ?>" value="<?php if(!empty($_GET['s'])) echo get_search_query(); ?>" placeholder='<?php echo $search_params['placeholder']; ?>' />
  27. <?php
  28.  
  29. // allows to add aditional form fields to modify the query (eg add an input with name "post_type" and value "page" to search for pages only)
  30. do_action('ava_frontend_search_form');
  31.  
  32. ?>
  33. </div>
  34. </form>
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement