current_page_item for category not working
-
I’m setting up my navigation bar so the active page gets highlighted. I have an item called “Past Blogs” on my navigation bar which links to a category. No matter what I try, I can’t get “Past Blogs” to highlight. I can get every other tab to highlight, just not this one.
Here’s how my code is set up currently:
<li<?php if ( is_home()){echo " class=\"current_page_item\"";}?>><a href="<?php bloginfo('url') ?>" title="Home">Home</a></li> <?php wp_list_pages("depth=1&title_li="); ?>I’ve tried adding “is_category()” like this:
<li<?php if ( is_home()||is_category()){echo " class=\"current_page_item\"";}?>><a href="<?php bloginfo('url') ?>" title="Home">Home</a></li> <?php wp_list_pages("depth=1&title_li="); ?>…but that didn’t work. Instead it made it so that when I click on “Past Blogs”, the current_page_item goes to the home page.
I’m all out of ideas and would really appreciate any help! Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘current_page_item for category not working’ is closed to new replies.