Opened 18 years ago
Closed 18 years ago
#8851 closed defect (bug) (fixed)
invalid XHTML markup in get_search_form function in general-template.php
| Reported by: | jcraig90210 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.8 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Old function:
function get_search_form() {
do_action( 'get_search_form' );
if ( != locate_template(array('searchform.php'), true) )
return;
$form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
<label class="hidden" for="s">' . ('Search') . '</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>';
echo apply_filters('get_search_form', $form);
}
New Function:
function get_search_form() {
do_action( 'get_search_form' );
if ( != locate_template(array('searchform.php'), true) )
return;
$form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
<div><label class="hidden" for="s">' . ('Search') . '</label>
<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>';
echo apply_filters('get_search_form', $form);
}
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Forgot to add. This corrects the fact that the search form doesn't validate according to XHTML standards. Will be correct for standard HTML as well.