DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Frank, a reader from UK, asked me how he can highlight the current page. When navigating throught pages, WordPress automatically add a class to the current element, so you can use css to style it as you want.

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;
}

Leave a Comment

Your email address will not be published. Required fields are marked *