Support

Home Forums Event Espresso Premium Why is the Past Events page showing all events, both past and future??

Why is the Past Events page showing all events, both past and future??

Posted: August 15, 2013 at 6:52 pm

Viewing 10 reply threads


miranda rota

August 15, 2013 at 6:52 pm

The Past Events page is showing ALL events, both past and future …plus it is also showing the button for people to register.
http://gator3027.hostgator.com/~yep1/past-events/

It just has the following shortcode in the page editing place: [EVENT_LIST show_expired=true]

Help to sort this out will be much appreciated!
And many thanks for your time ๐Ÿ™‚


Josh

  • Support Staff

August 15, 2013 at 8:19 pm

Hi Miranda,

It turns out that [EVENT_LIST show_expired=true] is designed to show the button for people to register, show past events, and show future events. There currently isn’t a shortcode that will display only past events.

I posted some code that can be added to a custom WordPress page template that will display a list of events in the past without a register button:

https://gist.github.com/joshfeck/5420669


miranda rota

August 16, 2013 at 7:04 am

Thanks Josh, could you say for the following:

1. Do we have to alter any of that code you’ve given …and if so, is it the bits in red colour? If so, could you give an example of that same bit of code with example info filled in?
2. In which folder would we put that page …is it in: wp-content – uploads – espresso?

Apologies for so many questions! I really do appreciate your efforts and time though, you are a ‘God’s send’


Josh

  • Support Staff

August 16, 2013 at 10:36 am

You can copy and paste the code directly into a page template. You would add the file to your active theme’s folder. Depending on the theme that you have installed, you would copy the page.php template and adapt it to include the custom event list. Then you’d set the page to use this custom template.

Here is another guide that goes into how to create/modify/use a custom page template:

http://justintadlock.com/archives/2009/03/13/page-templates-the-untapped-potential-of-wordpress


miranda rota

August 16, 2013 at 6:56 pm

Josh, I’ve uploaded your page: pastevents.php to the theme folder (it’s Thesis) and it’s now showing in the admin area of wp, in the Editor. I’ve read the tutorials you gave links to… but not sure what I do now ๐Ÿ˜‰ I tried going to edit that past events page, and tell it to use that template of yours, but template is not listed there as an option.

How do I make the Past Events page link up/’communicate’ with the pastevents.php page of yours??


Sidney Harrell

August 17, 2013 at 7:19 pm

Did you add a template header to the pastevents.php from Josh’s gist? So it should look like:

<?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) . '</a></li>';
 }
?>
</ul>


miranda rota

August 19, 2013 at 11:44 am

Sidney, thanks, yes that has connected that page now …but still very far from ready yet. This is the page it has made: http://gator3027.hostgator.com/~yep1/events/past-events/
…how on earth do I get it to look as it should, like the other pages?? Many thanks for your help!


Josh

  • Support Staff

August 19, 2013 at 3:56 pm

Hi Miranda,

The page template needs to include a header, sidebar and footer. Thesis is a little different than a lot of the themes out there. Normally what you’d do is make a copy of page.php and replace where it has “the loop” with your custom code.

Alternatively you could make the code example into a shortcode by using WordPress shortcode API.


miranda rota

August 28, 2013 at 5:09 pm

Apologies but just bumping this thread …don’t want it to auto-close


Josh

  • Support Staff

August 28, 2013 at 9:02 pm

Apology accepted.


Sidney Harrell

August 28, 2013 at 9:29 pm

I don’t have a copy of the thesis theme, so I can’t tell you exactly what lines of code you need to change. But if you refer to the documentation on “the loop” (http://codex.wordpress.org/The_Loop#Using_The_Loop) you should be able to find the loop in one of your existing templates, make a copy of the template file under a different filename, change the template name in the template comment header, and replace the loop with the above code.

Viewing 10 reply threads

The support post ‘Why is the Past Events page showing all events, both past and future??’ 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