modification to wp_list_pages: current_page_item
-
Hi folks,
I’m so close! I have a navigation menu based on wp_list_pages(). When I click on a child page, I want the ‘current_page_item’ class to REMAIN on the PARENT.
I am re-writing wp_list_pages and _page_level_out in the template-functions-post.php
The bit of code I need to modify is under _page_level_out() and it reads:
foreach ( $page_tree[$parent][‘children’] as $page_id ) {
$cur_page = $page_tree[$page_id];
$title = $cur_page[‘title’];$css_class = ‘page_item’;
if ( $page_id == $queried_obj->ID )
$css_class .= ‘ current_page_item’;Basically I need to modify this to say: If this is the queried object, and it’s the child of a parent page, then add the current_page_item to the parent.
I hope that makes sense. I’ve made a little progress, but I’m not a great coder. Your help is really appreciated.
- The topic ‘modification to wp_list_pages: current_page_item’ is closed to new replies.