Update "Calendar" Nav Menu Item with "current" class

Home Forums Calendar Products Events Calendar PRO Update "Calendar" Nav Menu Item with "current" class

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30222
    Will
    Participant

    Hello,
    I just found and modified this function from Rares Cosma, many thanks to whomever that is.

    Here’s the problem that it almost solved, and that I hacked further to fully solve: I’m using the WP 3.x “Menu” (dashboard > Appearance > Menu). When I’m on my custom created Calendar page, the menu adds a current-menu-item class that I can style. Yay!

    However, when I switch over to view single events, venues (and, in my case, organizers—I updated the tribe_organizer post type to include the slug and rewrite the url), the WordPress nav doesn’t have that nifty class added.

    So, this pastebin includes both functions that Rares Cosma created, with my additions to search for those additional bits of the path. I also modified the original function to add current-menu-item to the class, whereas Rares’ function added ‘parent_url’ to the class. You can put whatever you want on there.

    #30239
    Jonah
    Participant

    Hi Will,

    The easiest thing to do here would be to take advantage of body classes that should be available on any of these pages. For example on the single event pages you should have ‘events-single’ as a body class and on venue pages you should have ‘events-venue’. So you can use those to prefix your CSS selector and specifically target your events menu item when on those pages. Does that make sense/help?

    – Jonah

    #30266
    Will
    Participant

    oh duh. yeah that is a way easier solution than a function. Oh well.

    #30273
    Jonah
    Participant

    So are you all set here then Will?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Update "Calendar" Nav Menu Item with "current" class’ is closed to new replies.