astra_addon_get_search_form( bool $echo = true )
Display search form.
Description
Parameters
- $echo
-
(bool) (Optional) Default to echo and not return the form.
Default value: true
Return
(string|void) String when $echo is false.
Source
File: classes/astra-common-functions.php
function astra_addon_get_search_form( $echo = true ) { $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-addon' ) . '</span> <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search …', 'placeholder', 'astra-addon' ) . '" value="' . get_search_query() . '" name="s" /> </label> <button type="submit" class="search-submit" value="' . esc_html__( 'Search', 'astra-addon' ) . '" aria-label= "' . esc_attr__( 'Search', 'astra-addon' ) . '"><i class="astra-search-icon"> ' . Astra_Icons::get_icons( 'search' ) . ' </i></button> </form>'; /** * Filters the HTML output of the search form. * * @param string $form The search form HTML output. */ $result = apply_filters( 'astra_get_search_form', $form ); if ( null === $result ) { $result = $form; } if ( $echo ) { echo $result; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { return $result; } }
Expand full source code Collapse full source code View on Trac