Posted: 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. 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! |
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: |
|
|
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? Apologies for so many questions! I really do appreciate your efforts and time though, you are a ‘God’s send’ |
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 |
|
|
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?? |
|
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>
|
|
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/ |
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. |
|
|
Apologies but just bumping this thread …don’t want it to auto-close |
Apology accepted. |
|
|
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. |
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.