WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Div class "upcoming" used for past event listing - possible bug/oversight? (8 posts)

  1. Trebord
    Member
    Posted 1 year ago #

    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/

  2. jonahcoyote
    Member
    Posted 1 year ago #

    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

  3. Trebord
    Member
    Posted 1 year ago #

    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!

  4. jonahcoyote
    Member
    Posted 1 year ago #

    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

  5. Trebord
    Member
    Posted 1 year ago #

    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!!

  6. jonahcoyote
    Member
    Posted 1 year ago #

    Glad to be of assistance Trebord!

    Cheers,
    Jonah

  7. MsKristina
    Member
    Posted 1 year ago #

    This is exactly the problem I was tracking down.

    Where is that snippet of code supposed to go? :)

  8. jonahcoyote
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic