Support

Home Forums Event Espresso Premium List Past Events

List Past Events

Posted: July 2, 2012 at 12:04 pm

Viewing 4 reply threads


nhanusek

July 2, 2012 at 12:04 pm

I want to display a list of 50 past events. I just want to show the title and link to the detailed info. And I want it to be the most recent 50 (if I use the widget it shows them from the beginning of time, which is 1997 – not so useful!) What should I do?


Josh

  • Support Staff

July 2, 2012 at 4:02 pm

Event Espresso doesn’t have a feature that has this capability out of the box. That said, the event list template, and [EVENT_LIST] shortcode (from shortcodes.php) could be copied and customized to suit these specific needs. The way that the event_list works out of the box is it will display older events + any new active events if the [event_list] shortcode parameter is set to show_expired=true. That would also have to be refactored to show only expired events. So for this example, the refactored event_list shortcode could be named [PAST_EVENTS]

The new template based on the event_list template could then be refactored to show only the title and link to the detailed info.


nhanusek

July 2, 2012 at 4:09 pm

I think the shortcode was breaking my page (it kept make the page disappear, and redoing the permalink would fix it for some reason). Could you point me to some php that would do the trick? I have no problem creating a template page for it.


Josh

  • Support Staff

July 2, 2012 at 4:44 pm

I’m not able to point you to some PHP that would do the trick, but I can point you to the original event list display shortcode function that could be copied (and renamed) and modified in order to create a new shortcode. The function starts on line 310 of /includes/shortcodes.php. You could copy and rename this function into the custom_functions file of the custom files addon.

From there, the event_list.php and event_list_display.php templates could be copied over to /wp-content/uploads/espresso/templates, renamed, and refactored to work with this newly created shortcode.


nhanusek

July 3, 2012 at 10:57 am

If anyone is reading this and wants the php, I just made a custom template in my theme (super simple solution if you’re comfortable with code).

<ul>

<?php

$query = "SELECT * FROM wp_events_detail WHERE start_date  0) {

    while($row = mysql_fetch_array($result)) {
        $date = new DateTime(stripslashes($row['start_date']));
        $start_date = $date-&gt;format('F n, Y');

        $output .= "<a>".stripslashes($row['event_name'])."</a> (".$start_date.")"; 
    }
}
echo $output;

?>
</ul>

  • This reply was modified 12 years, 5 months ago by nhanusek.
  • This reply was modified 12 years, 5 months ago by nhanusek.
  • This reply was modified 12 years, 5 months ago by nhanusek.
Viewing 4 reply threads

The support post ‘List Past Events’ 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