Select list navigation help
-
I am creating a mobile theme for a friend, and their site is running on WordPress. On the mobile version, I want the navigation menu at the top to be a simple select list. I have that working just fine, but when you navigate to another page, I’d like the list to show you which page you’re on. I know this means adding the attribute selected=”selected” to that option in the list when that page loads, but I’m not sure how to do that. Somehow I need to tap into WordPress knowing which page it’s on, and then maybe Javascript or something to add the attribute.
If anyone has some helpful tips on what code I can use to make this happen, I would be very thankful.
Here’s the code I have in place for the select list:
<nav class="sections"> <div class="mini"> <select name="sections" id="subsection-select"> <option>- Navigation -</option> <option value="http://www.cwerksglobal.com">Home</option> <optgroup label="philosophy"> <option value="http://www.cwerksglobal.com/values/">values</option> </optgroup> <optgroup label="capabilities"> <option value="http://www.cwerksglobal.com/marketing-strategy/">marketing strategy</option> <option value="http://www.cwerksglobal.com/design/">design</option> <option value="http://www.cwerksglobal.com/manufacturing/">manufacturing</option> <option value="http://www.cwerksglobal.com/co-packing/">co-packing</option> <option value="http://www.cwerksglobal.com/safe-quality-food/">safe quality food</option> </optgroup> <option value="http://www.cwerksglobal.com/contact/">contact</option> </select> </div> </nav>
The topic ‘Select list navigation help’ is closed to new replies.