wp_list_pages Active State
-
I need to style a navigation list generated by wp_list_pages using css. There will be multiple top level pages and multiple subnav pages.
For some reason when I use this:
<?php global $post; if (is_page() && $post->post_parent ) { // This is a subpage wp_list_pages("title_li=&link_before=<h3>&link_after=</h3>&include=".$post->post_parent); wp_list_pages("title_li=&link_before=<h4>&link_after=</h4>&child_of=".$post->post_parent); } else { // This is not a subpage wp_list_pages("title_li=&link_before=<h3>&link_after=</h3>&include=".$post->ID); wp_list_pages("title_li=&link_before=<h4>&link_after=</h4>&child_of=".$post->ID); } ?>
I am not getting the class added on the li elements when the current page is active. All I get is li.page_item. When I click on a SUB-page the parent’s class changes to .current_page_ancestor .current_page_parent, but when clicking on the main nav item I get no class change. I looked into the post-template include file where the function is located, but I don’t see how they are creating those active classes.
Any ideas about what is going on?
Thanks!
Joe
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘wp_list_pages Active State’ is closed to new replies.