WordPress.org

Ready to get started?Download WordPress

Forums

add class "current" to navigation list item if a child page is selected? (4 posts)

  1. christianslater
    Member
    Posted 4 years ago #

    Hi,
    I'm using wordpress with the superfish jquery dropdown navigation. I a code to check the page or category ID and if the menu list item is in that actegory it gets the class "current". But now I havce the problem if subpages or subcategories are selected the main navigation point is not "current" anylonger. But I think it would be usefull for orientation. I allready searched the codex page but I can't get it working. How do I add that the li element get's th class current if a child page of it is selected as well?

    here's my code for now:

    <li <?php if (is_category('4')) { echo " class=\"current\"";}?>>

    same with page link like that:

    <li<?php if (is_page('96')) { echo " class=\"current\"";}?>>

    I allready tried something like that but that does not work!:

    <li<?php if (is_page('96=&child_of=96')) { echo " class=\"current\"";}?>>

    hope you can help me

  2. christianslater
    Member
    Posted 4 years ago #

    no ideas?!

  3. christianslater
    Member
    Posted 4 years ago #

    I can't imagine, that it's not possible! please help me :-(

  4. neilscott
    Member
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic