current_page_item works but not on home page.
-
Hi,
I’m in the process of building a template and using some css tabs for my site navigation. I’m trying to get my homepage to use the.current_page_item
class so it appears that the “home” nav tab is on top as the selected tab(of course). It works fine when you click a navigation link and go to that page (even on the homepage). However when i first load the main index page it does not.This is the site address(where it doesn’t work):
https://givethemsomethingbetter.com/gtsb/When you click on “home” it goes to this address (where
.current_page_item
class works correctly):
https://givethemsomethingbetter.com/gtsb/?page_id=2I’m lost trying to figure out how to get it to work.
This is how I’ve got my code set up so far:The HTML and PHP include:
<ul id="nav"> <?php wp_list_pages('sort_column=menu_order&title_li='); ?> </ul>
The CSS (would also like to know if I can make it function without having to use the !important declaration):
ul#nav li.current_page_item a { background-color: #fff !important; color: #CA3A44 !important; border-bottom: solid 2px #fff !important; }
Let me know if I’ve left out any pertinent information. Thanks so much in advance for the time and help!
- The topic ‘current_page_item works but not on home page.’ is closed to new replies.