Category page gives current_page_item
-
Firstly, I’ve solved this problem myself – but I thought I’d share the solution as well.
Basically in my CSS the current_cat and current_page_items are highlighted in the same way.
I noticed that when viewing a page, the correct menu item was highlighted. But when I viewed a category page both the category item and the page item were classed as current.
i.e. when viewing index.php?cat=5 both category 5 and page-id 5 were classed as current.
The solution is to edit the wp_includes/classes.php file. Look for:
function start_el($output, $page, $depth, $current_page, $args) { if ( $depth ) $indent = str_repeat("t", $depth); extract($args); $css_class = 'page_item'; $_current_page = get_page( $current_page ); if ($page->ID == $current_page ) $css_class .= ' current_page_item'; ...
you need to replace the line
if ($page->ID == $current_page )
with
if (is_page() && $page->ID == $current_page )
and that should do it.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Category page gives current_page_item’ is closed to new replies.