Skip to content

Instantly share code, notes, and snippets.

@shubhw12
Created June 22, 2020 15:17
Show Gist options
  • Select an option

  • Save shubhw12/29d9dfa511ab9ed39cfcb2af0eaa68e5 to your computer and use it in GitHub Desktop.

Select an option

Save shubhw12/29d9dfa511ab9ed39cfcb2af0eaa68e5 to your computer and use it in GitHub Desktop.
Change the place holder for the default search widget.
function custom_search_form( $form ) {
$form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
<label>
<span class="screen-reader-text">' . _x( 'Search for:', 'label', 'astra' ) . '</span>
<input type="search" class="searce-field" ' . apply_filters( 'astra_search_field_toggle_data_attrs', '' ) . ' placeholder="' . apply_filters( 'astra_search_field_placeholder', esc_attr_x( 'Your place holder', 'placeholder', 'astra' ) ) . '" value="' . get_search_query() . '" name="s" role="search" tabindex="-1"/>
</label>
<input type="submit" class="search-submit" value="Search">
</form>';
return $form;
}
add_filter( 'get_search_form', 'custom_search_form' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment