Dynamically highlight current page

October 20, 2008 · Print This Article

The function used to create a list of published pages, wp_list_pages(), automatically add a class current_page_item to the list item corresponding to the page you’re viewing.

You just have to add the .current_page_item class to your style.css file:
/* Style the list element */
li.current_page_item{
background:#eee;
color:#777;
}

/* Style the link element */
li.current_page_item a{
text-decoration:underline;
}


Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.