Originalmente inviato da
fotoebenessere
ma mi da errore.
Cosa scrive l'errore?
Con false la variabile stringa $form è il contenuto, quando stampato a schermo è output html o xhtml, prima della stampa dovrai modificare il contenuto. Come vorresti modificare un testo?
Codice HTML:
<form role="search" method="get" class="search-form" action="https://tuonick.altervista.org/">
<label>
<span class="screen-reader-text">Ricerca per:</span>
<input type="search" class="search-field" placeholder="Cerca nel blog..."
value="" name="s" title="Ricerca per:" required>
</label>
<button type="submit" class="search-submit">
<svg class="icon icon-search" aria-hidden="true" role="img"> <use xlink:href="https://tuonick.altervista.org/wp-content/themes/donovan/assets/icons/genericons-neue.svg#search"></use> </svg> <span class="screen-reader-text">Cerca</span>
</button>
Sempre dal manuale al link proposto in precedenza: A last option is to write a custom function (in your functions.php file) and hook that function to the get_search_form action hook.
Codice PHP:
/**
* Generate custom search form
*
* @param string $form Form HTML.
* @return string Modified form HTML.
*/
function wpdocs_my_search_form( $form ) {
$form = '<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" >
<div><label class="screen-reader-text" for="s">' . __( 'Search for:' ) . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search' ) .'" />
</div>
</form>';
return $form;
}
add_filter( 'get_search_form', 'wpdocs_my_search_form' );
https://developer.wordpress.org/refe...t_search_form/