Support » Plugin: The Events Calendar » Conditional for Calendar Listing Page

  • Resolved Ray Gulick

    (@raygulick)



    I tried the solution linked below, and it works for individual events, but it doesn’t work for the monthly calendar pages.

    https://theeventscalendar.com/support/forums/topic/conditional-for-all-tribe-events-pages/

    Here’s my function to add a class to the top-level nav item, using the conditional referenced above:

    add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);
    function special_nav_class($classes, $item){
         if ((tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' ) && $item->title == "Paso Robles")) { 
         $classes[] = "current_page_ancestor";
         }
         return $classes;
    }

    Here’s the link to the calendar page that does not highlight the top level nav (Paso Robles):
    http://www.adelaideinn.com/paso-robles-events-calendar

    There must a conditional that targets the listing page, right?

    • This topic was modified 1 year, 1 month ago by  Ray Gulick.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Anybody? I cannot seem to get the calendar conditional to identify the listing page as a calendar page.

    Even if I target the page template it can’t recognize the listing page as being one of the calendar pages:

    if (tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' ) || is_page_template( 'page_events.php' ))

    OK, this seems to get it:

    if (tribe_is_event() || tribe_is_month() || tribe_is_view('list') || tribe_is_view('day') || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' ) || is_page_template( 'page_events.php' ))
    Plugin Contributor András Guseo

    (@aguseo)

    Hi Ray,
    Happy to read that you managed to find a solution. Great job!

    Thanks for sharing your progress and solution!

    Cheers,
    Andras

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional for Calendar Listing Page’ is closed to new replies.