Forums

Custom taxonomy menu item highlighting (1 post)

  1. simonalextyler
    Member
    Posted 4 months ago #

    I have created a custom taxonomy called channels, using the following code in functions.php:

    [code moderated - please use the pastebin]

    Each channel has a main page, and then posts assigned to that channel via the menu in the post editor.

    However, I want to use CSS to highlight which channel the user is in - the channel menu is in a RH sidebar.

    When I've navigated to the channel page, the list classes are returned as follows:

    <div class="menu-channel-navigation-container"><ul id="menu-channel-navigation" class="menu"><li id="menu-item-421" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-417 current_page_item menu-item-421"><a href="http://www.notabaddad.com/notabadsite/?page_id=417" >General Dad</a></li>
    <li id="menu-item-404" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-404"><a href="http://www.notabaddad.com/notabadsite/?page_id=401" >Dad Hot Wire</a></li>
    <li id="menu-item-326" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-326"><a href="http://www.notabaddad.com/notabadsite/?page_id=317" >Pushchair Aficionado</a></li>
    <li id="menu-item-325" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-325"><a href="http://www.notabaddad.com/notabadsite/?page_id=320" >Teenage Riot Control</a></li>
    <li id="menu-item-324" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-324"><a href="http://www.notabaddad.com/notabadsite/?page_id=322" >Dad For Good</a></li>
    </ul></div>
    </div>

    which is great, as it allows the .current-menu-item class to be used to highlight the channel.

    But when I navigate to a channel post the class disappears:

    <div class="menu-channel-navigation-container"><ul id="menu-channel-navigation" class="menu"><li id="menu-item-421" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-421"><a href="http://www.notabaddad.com/notabadsite/?page_id=417" >General Dad</a></li>
    <li id="menu-item-404" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-404"><a href="http://www.notabaddad.com/notabadsite/?page_id=401" >Dad Hot Wire</a></li>
    <li id="menu-item-326" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-326"><a href="http://www.notabaddad.com/notabadsite/?page_id=317" >Pushchair Aficionado</a></li>
    <li id="menu-item-325" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-325"><a href="http://www.notabaddad.com/notabadsite/?page_id=320" >Teenage Riot Control</a></li>
    <li id="menu-item-324" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-324"><a href="http://www.notabaddad.com/notabadsite/?page_id=322" >Dad For Good</a></li>
    </ul></div>

    I wonder if anyone can shed any light on what I might be doing wrong? I wonder if there was an element to the function code I used in the first place...

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 4 months ago by simonalextyler
  • This topic is not resolved
  • WordPress version: 3.2.1