WordPress.org

Forums

[Plugin: Events Manager]Give single events a parent (4 posts)

  1. dankellys
    Member
    Posted 3 years ago #

    Hi, I have a menu in my website which has an 'on' state, so if you are on the parent page, or any of the child pages the parent link on the menu is highlighted, so users know which section they are in.

    So what i want to do is give all of the event pages a parent, so the Events link in the menu is highlighted when on a single event page. Is this possible?

    Cheers,

    Dan

  2. agelonwl
    Member
    Posted 3 years ago #

    Hi,

    I see what you mean, will also going to test this one and update you.

  3. Marcus
    NetWebLogic Support
    Posted 3 years ago #

    events don't support parents, as it's a post-style format, not like pages

  4. Ross Wintle
    Member
    Posted 3 years ago #

    Sorry to bump - I want to do this too. Been using the plugin for ages and just realised that since the post started using post types the single event pages set class="... current_page_parent ..." on the home/blog page.

    Could you not add an option to have a page used as the parent menu item for the events type and then filter on the nav_menu_css_class hook?

    Something like (code probably not quite correct):

    add_filter('nav_menu_css_class', 'em_nav_class', 10, 2 );
    function em_nav_class($classes, $item) {
        $post_type = get_post_type();
        if ($item->object_id == [new_option_value]) {
            array_push($classes, 'current_page_parent');
        };
        return $classes;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic