[wp-trac] [WordPress Trac] #16539: Duplicate search widgets cause ID conflicts
WordPress Trac
wp-trac at lists.automattic.com
Thu Dec 1 05:09:03 UTC 2011
#16539: Duplicate search widgets cause ID conflicts
------------------------------------+-----------------------------
Reporter: solarissmoke | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Widgets | Version: 3.0
Severity: normal | Resolution:
Keywords: dev-feedback has-patch |
------------------------------------+-----------------------------
Comment (by WraithKenny):
For those of you interested in implementing this directly into a Theme,
try:
{{{
<?php
global $search_form_counter;
if ( ! isset( $search_form_counter ) ) $search_form_counter = 0;
$form_id = $search_form_counter ? '' : ' id="searchform"';
$text_id = $search_form_counter ? 's_' . $search_form_counter :
's';
$submit_id = $search_form_counter ? '' : ' id="searchsubmit"';
$search_form_counter++;
?>
<form role="search" method="get"<?php echo $form_id; ?>
class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label class="screen-reader-text assistive-text" id="<?php
echo $text_id; ?>"><?php _e( 'Search', 'simple' ); ?></label>
<input type="search" class="searchinput field"
value="<?php echo get_search_query(); ?>" name="s" id="<?php echo
$text_id; ?>" placeholder="<?php esc_attr_e( 'Search', 'simple' ); ?>" />
<input type="submit" class="searchsubmit submit"
name="submit"<?php echo $submit_id; ?> value="<?php esc_attr_e( 'Search',
'simple' ); ?>" />
</form>
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16539#comment:30>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list