Style WordPress Sub Page Menus

Wordpress How-To's

Here’s a problem I’ve recently encountered while using the wp_list_pages function for a sub-page menu. The problem was that the “current_page_item” class was cascading to all the sub-page elements.

Here’s what it was looking like:

The particular function I was using was this:

 <?php wp_list_pages('title_li=&child_of=5'); ?> 

And here is what was rendered with that code:

Products 




All you need to do to control the sub-pages is to add a line to your CSS file. All I had to do was the tell it to use white instead of gray for the link color. Here’s the CSS I used:


li.current_page_item ul li a {
color:#FFF; !important;
}

Here’s what it looked like after the CSS fix:

What's the Buzz?

Andy is a true professional who is one of the most capable people I have ever worked with. His enthusiasm for his job is impressive and his ability to adapt and evolve to a new task is incredible. He is one of those rare people who you can tell where you want to get to and he can engineer the path there for you and give you extra choices along the way. His ability to learn new skills, willingness to continue to grow and expand is astounding. He’s also very skilled at what he does now and has a great eye for design and usability, blending form and function with class. And he’s fun to spend time with.

- Claire Devereux Thompson
Sterling Advertising