Support

Home Forums Event Espresso Premium Displaying Past Events in EE4

Displaying Past Events in EE4

Posted: February 18, 2019 at 12:45 pm


Angela Brookins

February 18, 2019 at 12:45 pm

Hi there, I want to display past events in a nice manner, but currently have created a category called “Past Events” and must manually tag them, which I want to avoid. Can you advise if there is a good way of doing so that will be automatic?


Josh

  • Support Staff

February 18, 2019 at 6:27 pm

Hi,

You could download & install this simple little plugin:
https://gist.github.com/joshfeck/2f8c67a51ebeec117c7dc3a5cb4e0051

Then place a [espresso_past_events] shortcode on a page of your site where you want to display a list of past events.


Angela Brookins

February 20, 2019 at 12:28 pm

Hi Josh, any way I can customize to show a banner of the featured image?


Josh

  • Support Staff

February 20, 2019 at 1:40 pm

Sure, you can add some more code to the template. For example:

if ( has_post_thumbnail()) :
  $output .= get_the_post_thumbnail( null, 'medium', array( 'class' => 'alignleft' ) );
endif;

Will add a medium-sized featured image and align it to the left side.


Angela Brookins

February 22, 2019 at 3:48 pm

Could you advise where exactly to place the above snippet?


Josh

  • Support Staff

February 25, 2019 at 9:29 am

Hi,

The exact location will depend on where exactly you want the featured image to be displayed. One place you could put the code would be immediately after the title. The title is made by this line of code:

$output .= '<strong class="event-title">' . get_the_title() . '</strong>';

So if you add the image after the title, that part of your modified code will look like this:

$output .= '<strong class="event-title">' . get_the_title() . '</strong>';
if ( has_post_thumbnail()) :
  $output .= get_the_post_thumbnail( null, 'medium', array( 'class' => 'alignleft' ) );
endif;
$output .= '<div class="event-items">';

The support post ‘Displaying Past Events in EE4’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso