Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Modifying Past Events page | Event Espresso - Staging Server

Support

Home Forums Event Espresso Premium Modifying Past Events page

Modifying Past Events page

Posted: October 11, 2013 at 1:01 pm

Viewing 6 reply threads


Tom Semmes

October 11, 2013 at 1:01 pm

I found a great resource for creating a page that lists only past events
http://staging.eventespresso.com/topic/why-is-the-past-events-page-showing-all-events-both-past-and-future/
Any chance you could show me how to modify it to include the date as well as the event title?
http://new.asisnyc.org/events/past-meetings/

I am using most current version of WordPress and Event Espresso


Dean

  • Support Staff

October 14, 2013 at 2:57 am

Hi,

The $pastevent is an array of the event details, so you can echo/add $pastevent->start_date

eg

<?php
/*
Template Name: Past Events
*/
?>
<ul>
<?php 
global $wpdb;
$tablename = $wpdb->prefix . events_detail;
$pastevents = $wpdb->get_results("SELECT * FROM $tablename WHERE start_date < curdate() AND event_status <> 'D' ");
 foreach ( $pastevents as $pastevent ){
 echo '<li><a href="' . espresso_reg_url($pastevent->id) . '">' . stripslashes($pastevent->event_name) . ' - ' . $pastevent->start_date . '</a></li>';
 }
?>
</ul>

I haven’t tested it, but you will probably need to reformat the date as it is likely to spit it out like 2013-10-14.

date(‘d-m-Y’, $pastevent->start_date) should work, see here for more info http://php.net/manual/en/function.date.php


Tom Semmes

October 14, 2013 at 10:26 am

Thanks Dean
Just replace
$pastevent->start_date
with
date(‘d-m-Y’, $pastevent->start_date)
?
This doesn’t seem to work for me but maybe I am doing something wrong.


Tom Semmes

October 14, 2013 at 10:35 am

Got it! the code I wanted is actually
date("F j, Y", $pastevent->start_date)
I am feeling so smart right now…. :-)


Tom Semmes

October 14, 2013 at 10:39 am

Oops! Right formatting but it reverts to a date of something like January 1, 1969 and not the date of the event. Guess I could use your help after all. Any idea how to correctly write the PHP for this?


Josh

October 14, 2013 at 11:22 am

php date() needs a string or a timestamp in order to work. In this case you can use date_create and date_format. Here’s a revised loop that displays the date using date_create and date_format:

foreach ( $pastevents as $pastevent ){
 	$my_event_date = date_create($pastevent->start_date);
 	echo '<li><a href="' . espresso_reg_url($pastevent->id) . '">' . stripslashes($pastevent->event_name) . ' - ' . date_format($my_event_date, 'F j, Y' ) .'</a></li>';
 }


Tom Semmes

October 14, 2013 at 2:10 pm

Thanks Josh

Viewing 6 reply threads

The support post ‘Modifying Past Events page’ 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 - Staging Server