Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

background color for current tab WordPress


The question is in reference for this site:

Before I customized the menu, the background of the tab on the menu that is current would be black.

For example, if you click on "Contact", the tab on the menu would be black if you are on that page. Since I customized the menu, the coding completely changed and the theme didn't provide the proper CSS code to keep that tab feature.

What do I need to change in the CSS files to make the background of a current tab another color when you are on that page?

Thanks in advance for your help!


Answers (3)


Kailey Lampert answers:

In the css file, you have a few lines (446, 447) like this

#access ul li.current_page_item > a
#access ul li.current-menu-ancestor > a,

You should just be able to add a comma after the first line to fix the problem
#access ul li.current_page_item > a,
#access ul li.current-menu-ancestor > a,

Sinoun Chea comments:

OMG I can't believe it was that easy. LOL. Thank you soooo much!!!!


Caroline Keim answers:

You should look into this link.

if (is_home())
echo " class=\"active\"";
?>><a href="#">Page One</a></li>

You would have to add something like this for other pages -

if (is_page('About'))
echo " id=\"active\"";
<a href="<?php bloginfo('url') ?>/about">About</a>

Then give active attributes in the CSS so it's a black background.


Gabriel Reguly answers:

Kailey Lampert just gave you the correct solution.