Skip to content

Documentation

Extensive Documentation for PowerPack & WooPack to help you with common questions and issues.

PowerPack

  1. Home
  2. Docs
  3. PowerPack
  4. Modules
  5. Search Form
  6. How to Customize Search Form Input Attributes?

How to Customize Search Form Input Attributes?

pp_search_form_input_attrs hook can be used to filter the Input Attributes for PowerPack Search Form.

Parameters:

$attrs – an ARRAY containing a key-value pair of all the attributes required for a Search Form.

$attrs = array(
         'placeholder'	=> $this->settings->placeholder,
         'class' 	=> array( 'pp-search-form__input' ),
         'type' 	=> 'search',
         'name' 	=> 's',
         'title' 	=> __( 'Search', 'bb-powerpack' ),
         'value'        => get_search_query(),
);

$settings – an OBJECT containing all the settings for the Search Form module instance.

 

These can be filtered by adding a custom filter in the theme’s functions.php file as shown below.

 

   add_filter( 'pp_search_form_input_attrs', 'my_function_modify_pp_search', 10, 2 );

   function my_function_modify_pp_search( $attrs, $settings ) {
           
       $attrs['placeholder'] = 'My Search';
       return $attrs;
    } 

Want to add Live AJAX Search to PowerPack Search Form? Click here.

Was this article helpful to you? Yes 1 No
🎃 🎃

EXTENDED - Biggest Sale Ever! Get up to 50% OFF    Grab the Deal

×