Support » Plugin: The Events Calendar » Div class "upcoming" used for past event listing – possible bug/oversight?

  • Resolved Trebord

    (@trebord)


    Hello,

    I’ve been attempting to implement a couple of CSS edits for the past events listing page (…/events/past/). However, I’ve been unable to locate any id’s or classes unique to the page. What I’ve found, though, is a wrapper div class called “upcoming”, which is also used – unsurprisingly – for the upcoming events listing (…events/upcoming/). Is this a bug? If there’s an “upcoming” div class used to wrap the list of upcoming events, surely someone meant to implement an equivalent “past” class to enclose the list of past events? Any thoughts on how I might get around this difficulty?

    Thanks!

    http://wordpress.org/extend/plugins/the-events-calendar/

Viewing 7 replies - 1 through 7 (of 7 total)
  • jonahcoyote

    (@jonahcoyote)

    Hi Trebord,

    Unfortunately as you’ve found there is no body class or identifier for this particular page. The only way you would be able to do this is by adding your own body class. If you take a look at our documentation here, particularly the tribe_is_past() function, you should be able to add your own body class: http://tri.be/support/documentation/the-events-calendar-template-tags-loop-functions/#functiontribe_is_past

    Here’s an example of how to filter the body_class: http://codex.wordpress.org/Plugin_API/Filter_Reference/body_class

    I hope that helps!

    – Jonah

    Trebord

    (@trebord)

    Ok – Maybe it’s not too late to get this into the upcoming v.3? 😉

    I very much appreciate you pointing me to the support docs – I’ll see if my very limited coding skillset is enough to put something together.

    Thanks for your help, and for a great plugin!

    jonahcoyote

    (@jonahcoyote)

    Hey Trebord,

    You can easily add this using a snippet like this:

    /*-----------------------------------------------------------------------------------*/
    /* Adds new body class
    /*-----------------------------------------------------------------------------------*/
    add_filter('body_class', 'add_browser_classes');
    function add_browser_classes($classes){
        if(tribe_is_past()) {
          $classes[] = 'events-past';
        }
    
        return $classes;
    }

    I hope that helps!

    – Jonah

    Trebord

    (@trebord)

    Sorry on the delay on getting back to you, Jonah, but THANKS! That worked like a charm – and I even learned something!

    Thank you for your outstanding support – Much appreciated!!

    jonahcoyote

    (@jonahcoyote)

    Glad to be of assistance Trebord!

    Cheers,
    Jonah

    MsKristina

    (@mskristina-1)

    This is exactly the problem I was tracking down.

    Where is that snippet of code supposed to go? 🙂

    That would go into your theme’s functions.php file.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Div class "upcoming" used for past event listing – possible bug/oversight?’ is closed to new replies.