I have a header and a footer menu (they're the same: Primary Menu). When I'm on a page, wordpress adds classes like current_page_menu
. But on pages where I use the query_posts()
function the menus after this function dont have those classes added like current_page_menu
etc.
Here is my code that is causing the bug:
<?php
$title_slug = strtolower(str_replace( " ", "-" , the_title_attribute('echo=0') ) );
$id_obj = get_category_by_slug($title_slug);
$cat_id = $id_obj->term_id;
query_posts( 'cat='.$cat_id.'&post_status=publish,future&paged='.get_query_var('paged') );
?>
This code is very useful, though. As it ensures to create a category page by adding a page and selecting the category page template instead of just a link to that category. I had to do this because my category pages need to have child pages.
I'd be greatful if anyone knows a solution!