As you can see I was able to add dynamic menu highlighting to the homepage link, but how would I add this too the rest of the dynamically generated page links? Can I add something to “wp_list_pages(‘title_li=&depth=1’)” in order to add the id=”current” to the currently selected page?
Thanks in advance. I’m new to wordpress and just figuring our my way around…
Well, it’s really quite simple. Every item in a list that’s generated by wp_list_pages looks has a couple of css classes applied. an item looks like this: <li class="page_item page_item-11"><a href="http://domain.tld/page-name/"></li>
page_item-11 means that the page’s ID is 11. The page you are currently viewing looks like this in the list: <li class="page_item page_item-11 current_page_item"><a href="http://domain.tld/page-name/"></li>
This way you can highlight the page in the pages list when it’s being viewed. To imake things easier for you change id=”current” to class=”current_page_item”. You can then create style rules for the different classes in you theme’s stylesheet.
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘help with adding ID to wp_list_pages()’ is closed to new replies.