Posted: October 3, 2017 at 10:04 pm
Hey EE4 Team, Getting right into detail: I’ve customized this code: ESPRESSO_EVENTS_TABLE_TEMPLATE I had uploaded the file: /wp-content/uploads/espresso/templates/espresso-events-table-template.template.php (pretty much using this code [ https://gist.github.com/joshfeck/822763b36a371f7ec43e ] with modifications to “trim out the fat” per se.. in other words, I’m checking to see what the URL is and depending on that, to show all events, this month’s events only, or past events… so mainly just date modifications.) I’ve been using the ESPRESSO_EVENTS_TABLE_TEMPLATE code for quite some time: [ESPRESSO_EVENTS_TABLE_TEMPLATE show_expired=true show_all_datetimes=true sort=DESC table_paging=false] This code would result in me being able to view ALL PAST EVENTS on a single page without the need for any pagination. Up until recently, it is like any code within that espresso-events-table-template.template.php file is being ignored. I had it set to only show OLD events that were past and expired. However, it is showing some OLD events for up to about 10 days ago and NEW events and future events only. I’ve attempted to compensate and even go back to pagination and it does work, but the per_page defaults to 10 no matter what number I put in, 20, 25, 50, or 100… all resulting in about 90 pages of pagination and its just an awful mess. Is there any way I can change this number to per_page=100? And show only past events? OR how can I ensure that espresso-events-table-template.template.php is being recognized? Thanks for your help. |
|
Here is a sample of what I’m talking about with the Pagination: https://mypost.io/post/kj-pagination It is just a bit too much when I can only view 10 events per page. |
|
Hi there,
The shortcode above won’t do that alone, so I’m assuming you did some further filtering within the template file?
Where are you changing per_page? The ‘limit’ attribute sets the post_per_page value on the query, but by default, it should default to a high value (1000) not 10.
Add the limit attribute,
EE doesn’t have an option to show only past events, you mentioned you had this working previously so I’m guessing you have some custom code in the template to do that for you?
You can add something like this:
To your custom template just after the do_action call, so on the link for Josh’s example line 13 is fine, on the current versions its line 17 – http://take.ms/AHHLN Then load the page, and see if you see the path to your custom file output to the page – http://take.ms/J9bmf Can you link me to the page so I can see what events are being pulled? Using the above shortcode that you posted on the latest version of the Events Table, default template loads the events that I would expect. |
|
Hey Tony, thanks for your response. As I said, the template file has been modified to filter the dates. So I’m simply checking to see IF event date < currentdate OR event date = expired then show. I am taking that code from Josh which is looping through the posts to show events and then applying the filter which should render it to be showing me ALL expired events, but yet its cut off as if it somehow is limited to displaying no more than 25 events or so. Do you think it could be a memory limit cutting out? To get into more detail, I began receiving memory limit errors with Event Espresso, unable to access the backend at all, but was able to fix it by increasing the memory from around 256M to 512M and then 1024M. But it still doesn’t seem to be working correctly. As for setting the limit=100… then it only shows the up to 100 events and nothing else. I need to show ALL expired events.. and right now I can only do that with those 88 pages of pagination. |
|
Tony, my problem seems to be… not of the dates going back or the expired, but the limitation for how far back I can go from this file. I can’t recall it being an issue before. It seems I can go back to events as far back as July 30, 2017. However, any events before that date… and we’ve been using Event Espresso since about April 2016…. aren’t showing at all.
|
|
I understand you’re filtering the events, but it wasn’t clear if you’re altering the query to pull expired events, or just checking the dates of all your events within the template, you’re doing the latter.
If you install Debug bar on the site, load up the page with the table view template and check the ‘queries’ tab. Search for ‘SELECT SQL_CALC_FOUND_ROWS wp_posts.’ and post the query here, please. This is mine using the latest version of the Table view template – http://take.ms/Ph2S1 That pulls all of my events. If you temporarily rename your template file so that EE uses the default (just add
Possibly, although you would normally see an error in the error logs if that happens.
The amount of memory you use depends on multiple different factors, but pulling in all of your events then looping through them is going to use a fair amount. Is it just the template that isn’t working are other areas? |
|
Hey Tony, Took me a few days to get around to do the testing in your reply. 1. If you install Debug bar on the site, load up the page with the table view template and check the ‘queries’ tab. I’ve installed the bar (wp_config.php debug to true) and attempted to track down these errors.. or warnings, do you think they would be affecting why all listings of the past are not showing up? Request: events-list-archive Query String: pagename=events-list-archive Matched Rewrite Rule: (.?.+?)(?:/([0-9]+))?/?$ Matched Rewrite Query: pagename=events-list-archive&page= TOTAL WARNINGS: NOTICE: wp-content/plugins/equivalent-mobile-redirect/equivalent-mobile-redirect.php:250 – Undefined index: emrall >>> possible plugin conflict? since the theme is not responsive nor event espresso, this changes the website to show a different page in mobile (in which we use Event Espresso’s list view instead of the calendar) NOTICE: wp-content/plugins/functions.php:375 – Trying to get property of non-object >>> >>>>>> this was a code i found to prevent the event espresso featured image from doing weird things — like when you hovered over it, it would “zoom” — this makes the image normal. //DISABLE THE IMAGE CLICK FOR FEATURED IMAGE ON EVENTS PAGE add_filter( ‘post_thumbnail_html’, ‘post_thumbnail_html’, 10, 3 ); <<< NOTICE: wp-content/uploads/espresso/templates/espresso-events-table-template.template.php:241 – Undefined variable: startdat >>> $startdat = $datetime->start_date_and_time(); //looks defined to me, do i need to set it as a global? 2. If you temporarily rename your template file so that EE uses the default (just add -temp to the filename) and retest, do you get all your events? 3. This is mine using the latest version of the Table view template – http://take.ms/Ph2S1 4. Is it just the template that isn’t working are other areas? All other areas seem to be working. I have 1 template, but within that template, which is inside of a loop of the database, I am looking at the page URL and determining what should be done based on that. |
|
It’s not really a conflict, its the equivalent-mobile-redirect plugin trying to use values before checking the exist. That particular error is from that plugin trying to use the ’emrall’ options (from its own options) when its not set. That should be fixed on their end.
I’m fairly sure that’s not from Event Espresso, either way the code needs to check the object is valid before doing anything to it.
No, you don’t need to make it global.
Ok, so can you provide the results for the query I requested above.
It sounds like the query is being filtered which is why I asked for the above. Can you re-run through the steps above and post up the query that is being used to generate the table, like in my example screenshot. |
|
Hey Tony, I installed Query Monitor to get the database call as the Debug Bar wasn’t showing me queries. This was the only thing I could find that closely resembled your screenshot. SQL_CALC_FOUND_ROWS:
If it helps any, this is the full code I have in espresso-events-table-template.template.php with the Gist I gave above which sits below all the important workings in the beginning of the file.
Just so you have an idea of how this table renders: https://goo.gl/2hgxd5 |
|
So in the query you can see this:
Which means EE is only pulling in events with a date end set greater than now. Filtering the events after that won’t show all events as the events aren’t there to filter. Can you let me know the version number of the template add-on you are using, and the version of EE4 please, I’ll do some digging into this. |
|
Can you double check that your shortcode has |
|
Hey Tony, here is the template code: [ESPRESSO_EVENTS_TABLE_TEMPLATE show_expired=true show_all_datetimes=true sort=DESC table_paging=true] For now, I have table_paging set to true so my client can see events from a year ago. When set to false, we are not getting ALL events showing, as stated in earlier posts. Event Espresso 4.9.45.p |
|
Can you create a new test page and add the original shortcode without paging on that page so I can view it, please? If you don’t want to post the link here then just let me know the page slug and I’ll find it from that on your site. |
|
Hey Tony, This page will lead you to the link that will take you directly to the website. As this is a client of mine, and I do respect her right to privacy, just let me know when you have the link so I can delete that page. https://mypost.io/post/kjtestpage Remember: The template is still the same, but now allows for this new test page to load all the events by looking at the URL. Note: Give it a few … the total memory on the server is 1 GB and it may take a minute or 2 to load. Also: The very first listed class was April 1, 2016 12:00 am. My client wishes for ALL events, expired, sold out, etc. to be shown on a single page. I do understand that this could cause a severe delay from the database, but I’m not sure why it would be limited to not showing more. Could we be limited via the host? Each page in the backend of WordPress shows 100 events per page, so it is showing around 10 pages each. However, even with any template code for the front end, such as showing 100 events per page would be ideal, it is currently only showing 10 or so at a time, regardless of what number I put into the code. I’ve also set the paging to false. |
|
Now I can see the output, I think the problem is the default All ~800 of your events are loading on the page – http://take.ms/URsaR However, the template does a couple of checks when loading which is affecting the output and setting Try adding If not I’ll need access to the site to investigate this further, the query you posted above doesn’t match the output as its pulling events with a |
|
Hey Tony, This is now fully functional and working. The site was sitting on Shared Hosting which has its limitations. You can read about the details about what happened here: https://eventespresso.com/topic/event-espresso-data-and-database-usage/ Definitely a journey… and a learned experience. When put onto a VPS or Cloud server, it has a chance to spread its wings. So… loading that many database entries on to a page… might take a minute or two, but the results are that it is showing all the records. I do appreciate your help. So… this ISSUE has been RESOLVED. |
|
Great, I’m glad it’s now working. I’ll mark this thread resolved. |
|
The support post ‘ESPRESSO_EVENTS_TABLE_TEMPLATE issues’ 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.