Support

Home Forums Event Espresso Premium List past events

List past events

Posted: April 18, 2013 at 4:16 pm

Viewing 3 reply threads


Vanessa Chu

April 18, 2013 at 4:16 pm

I want to have a simple list of past events on a widget in my sidebar. I found this previous post: https://eventespresso.com/topic/list-past-events/#post-9279 asking about this exact issue and another user suggested some code to be implemented on a template file, but I don’t know where this code goes or how to use it. Any help would be appreciated it. Thanks.


Josh

  • Support Staff

April 18, 2013 at 4:51 pm

The code posted in the other forum thread would go into a custom page template in your WP theme. You could use the same code in a widget by using a plugin like this one:

http://wordpress.org/extend/plugins/php-code-widget/


Vanessa Chu

April 18, 2013 at 5:07 pm

Josh, the code that the person posted was scrambled. It changed some of the symbols into ascii, I think. So I attempted to convert some of the ascii back to the correct characters. However, the code doesn’t seem to work when I put it in the PHP widget. Can you take a look at what I have (pasted below) and see if I the code is correct? Thanks!

<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-&>format('F n, Y');

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


Josh

  • Support Staff

April 19, 2013 at 8:24 am

Hi Vanessa,

It looks like some things are missing. I don’t know how to fix it.

Here is some sample code that will display a list of events from past you could build on:

Viewing 3 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