WP HOOKS
filtrod 2.7.0

get_search_form

Args 2Plik wp-includes/general-template.phpDokumentacja WP ↗

Opis

Podmienia domyślny formularz wyszukiwania.

Przykład użycia

add_filter( 'get_search_form', ... )php
add_filter( 'get_search_form', 'wpdocs_search_form' );

function wpdocs_search_form( $form ) {
	return '<form role="search" method="get" action="' . esc_url( home_url( '/' ) ) . '">'
		. '<input type="search" name="s" value="' . esc_attr( get_search_query() ) . '">'
		. '<button type="submit">' . esc_html__( 'Szukaj', 'wpdocs' ) . '</button>'
		. '</form>';
}

Parametry

ParametrTypOpis
$formstringThe search form HTML output.
$argsarrayThe array of arguments for building the search form. See get_search_form() for information on accepted arguments.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'get_search_form', 'twoja_funkcja', 10, 2 );

function twoja_funkcja($param_1, $param_2) {
	// Twój kod
}

Popularne w tej kategorii