Reputation: 23
in wordpress, how do I know what page is current?
I have 5 pages that are my header menu bar, I want to CSS the current (open page) so user knows whats page they are on. Is there a way of doing this?
thanks
Upvotes: 2
Views: 244
Reputation: 1
using CSS, you can style the current page of WordPress.
CSS:
li.current_page_item a {
color: red;
}
this WordPress Codex page may explain the whole process better: http://codex.wordpress.org/Dynamic_Menu_Highlighting
Upvotes: 0
Reputation: 3294
You should be able to use the is_page() function. You can use the page id, name or slug as an argument.
Examples:
<a href="#" <?php if(is_page(42)) echo 'class="active"'?>>Page 42</a>
<a href="#" <?php if(is_page('About Us')) echo 'class="active"'?>>About Us</a>
<a href="#" <?php if(is_page('our-friends')) echo 'class="active"'?>>Our Friends</a>
Upvotes: 2