Aohor Arsalan
Aohor Arsalan

Reputation: 191

How to remove Menu Item Class form secondary menu

I'm building a wordpress theme. my menus are getting classes from wordpress, like: .current-menu-item, .current_page_item & I'm using them to customize my active menu background color:

.current-menu-item a, .current_page_item a {
    background-color: #ffef38;
}

but the problem is I've a secondary menu in footer, which is getting this style from css too. css for my footer is quite simple:

#footnav {
    float: right;
}

#footnav li {
    display: inline-block;
    border-right: 1px solid #fff;
    padding: 0 0.5em;
}

#footnav li:last-child {
    border-right: none;;
}

so my question is, how can I remove the active menu styles from my footer menu only?

Upvotes: 0

Views: 275

Answers (1)

Josh from Qaribou
Josh from Qaribou

Reputation: 6908

Either configure the styles to whatever you want on the footer:

#footnav .current-menu-item a, #footnave .current_page_item a { background-color:transparent; }

or make your initial selector more specific:

nav.myclass .current-menu-item a, nav.myclass .current_page_item a {
    background-color: #ffef38;
}

Since you sound like you're just concerned about the styling, I wouldn't think about touching the PHP that actually generates those classes in the first place, since they may be relied upon for other things (e.g. javascript.)

Upvotes: 1

Related Questions