Hallo Zusammen!
Ich würde gern eine eigene searchform.php-Datei anlegen, damit ich den Code besser kontrollieren kann. Im codex ist leider noch nicht viel dazu findbar. Daher meine Frage an die Profis :mrgreen: O.K., mein Problem:
Aus der Datei wp-includes/general-template.php wird folgender Code eingefügt:
PHP
$form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
<label class="hidden" for="s">' . __('Search for:') . '</label>
<div><input type="text" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
<input type="submit" id="searchsubmit" value="'.attribute_escape(__('Search')).'" />
</div>
</form>';
Um die Funktionalität zu prüfen habe ich genau das genommen und in eine searchform.php gelegt.
PHP
<?php
/**
* @package WordPress
* @subpackage Template
*/
?>
<h2>Suche</h2>
<form method="get" id="searchform" action="<?php get_option('home'); ?>" >
<label class="hidden" for="s"><?php __('Search for:'); ?></label>
<div>
<input type="text" value="<?php attribute_escape(apply_filters('the_search_query', get_search_query())); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="<?php attribute_escape(__('Search')); ?>" />
</div>
</form>
Alles anzeigen
Leider werden bei der Ausgabe die wp-Tags nicht gefüllt. Was mache ich da falsch?
Anzeige WP-Standard (ohne searchform.php):
HTML
<form method="get" id="searchform" action="http://localhost:8888/testblog/" >
<label class="hidden" for="s">Search for:</label>
<div><input type="text" value="" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
»Meine« Ausgabe:
HTML
<h2>Suche</h2>
<form method="get" id="searchform" action="" >
<label class="hidden" for="s"></label>
<div>
<input type="text" value="" name="s" id="s" />
<input type="submit" id="searchsubmit" value="" />
</div>
</form>
Ich freue mich auf Hinweise und bedanke mich bereits jetzt schon für eine evtl. Hilfe!
Andreas