Search box duplicate IDs
-
I hope you’ll be able to help.
Here is the scenario:1.have a search box in the menu using this code:
function add_search_box($items, $args) { if($args->theme_location == 'header-menu') { ob_start(); get_search_form(); $searchform = ob_get_contents(); ob_end_clean(); return $items .= '<li id="searchform-item">' . $searchform . '</li>'; } return $items; }
2.have a search box in the sidebar as well but hide it from view for screen sizes max-width above 800px;
3.hide the menu search box from the menu for screen sizes below and equal to 800px;
4.display the search box in the sidebar for creen sizes below and equal to 800px.This works, but the W3C validator is complaining about the duplicate IDs. This is because
the same search form with all the elements is used twice for the menu as well as the sidebar.
Is there any way to change all the IDs in the searchform.php to classes? Or is there another solution.
I would be grateful for your help. I am not using this at the moment until I find a solution – hopefully.
- The topic ‘Search box duplicate IDs’ is closed to new replies.