Grow your CSS skills. Land your dream job.

WordPress – How to Style the Children of current_page_item

  • # October 12, 2009 at 11:43 pm

    Hi everyone,

    I have a question that I hope someone can help me with.

    I’m using wp_list_pages to generate my navigation. It’s a vertical list. Here is the code generated.

    And here’s the CSS that makes the background of the current page link change colour:

    Code:
    #main-nav li.current_page_item a { background-color:#CCC; }

    Problem is: When you’re on the "Accommodation" page, the "Accomodation" link background colour changes but so does the links for the 3 rooms as well.

    I’ve tried a bunch CSS to try and remove the styling of the children of current_page_item but none work.

    Please note it works fine when your on a room page. ie only the room link changes colour.

    Any help would be very much appreciated!

    PS I had to login to this forum 4 times to post this.

    # October 13, 2009 at 2:31 pm

    From what you have posted it is pretty hard to say. It’s obviously some kind of specificity problem, I would suggest checking it with firebug or post a link.

    # October 13, 2009 at 9:25 pm

    Oh boy… my bad. Stupid mistake on my behalf. Spelling mistake in the CSS. Sorry to waste peoples time. Can we delete this post?

    Thanks Apostrophe.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".