Posted: December 22, 2015 at 7:20 am
We’re having a very weird issue with the ESPRESSO_EVENTS shortcode. We have an empty page that uses a template file with 4 different div containers where each container has a separate shortcode for a different category-slug. There is jQuery attached to the page with a dropdown that hides/shows each div according to what you select. All of a sudden, it no longer works and shows the same default category slug no matter what is selected. I checked the source of the page and find the jQuery is doing its job hiding and showing the appropriate div container, the problem is all the same events for the first category are listed in all 4 div containers. This is what it looks like: <select id=”soflow”> <div id=”wmnfevents”> When this page loads, all 4 div containers have the same records for the category-slug of wmnf-events. The weird thing is that the page still works on our development site. I have checked the events to ensure they are assigned to the correct categories and verified the same version of plugins are used on both sites. The only difference between the live site and dev site is basically the HTTPS being used on the live site. Do you have an idea why this would be happening now or how to troubleshoot further? |
|
It sounds like something is resetting the query. Do you have the same version of WordPress on both sites? One other thing you can do that may help is remove those double quotes for each parameter value, with the exception of the title= parameter, and you’ll want to make sure that those are not curly quotes in your code. |
|
No, the dev site is running the latest 4.4 and we have not upgraded from 4.3.1 on the live site yet. I was hoping to wait until I’m back in town from a holiday trip before doing that, but guess I can try if you think that may be an issue. |
|
I asked about the WordPress version because I was wondering what other things might be different from the dev site to the live site. If it’s only https and WP version, then that may be an indication that is a WP version issue. But if this worked before on WP 4.3.1, then it may be something else unique to the live site. |
|
Yeah, I realized the WP version was different after I posted my question. I believe I have published all other changes to the live site in an effort to resolve and will try the WP upgrade later. Thanks. |
|
Still trying to debug this issue and have a question. Like I said, it is very perplexing that this still works on our dev site, but any attempts to duplicate the page and template have the issue. To try and understand if there is any server related problem, I have downloaded a fresh copy of the live site to the local dev server and updated accordingly for the different domain. For some reason, EE4 thinks I have version 4.7.9.p, but looking in the plugins, it indicates 4.8.27.p is installed and the db was dumped from the live site in its current state. This is the message I’m receiving on our dev server where all was copied to: Event Espresso has detected event data from version EE4.7.9.p (Core) that can be migrated (updated) to work with version EE4.8.0 (Core). Do you know why this would be? |
|
Debugging and searching for an answer to this issue. I found this post that describes exactly the same thing: I also posted the issue to Stack Exchange and one person noted that “you should never ever use $wp_query as a local variable, this breaks the main query object which might cause issues” when looking at the process_shortcode function in the plugin EES_Espresso_Events.shortcode.php file. Just wondered if either of these tell us anything related to the issue? Also, while debugging, I put the four instances of the shortcode in the page instead of using the template with do_shortcode calls and it works, the different records for each category showing correctly. However, this presents other issues with getting all the styles and titles to work as we had. |
|
You’ll have a better time with the custom template if you do not use the [ESPRESSO_EVENTS] shortcode within the template using do_shortcode calls. It was never intended to be used this way. If you’re already using a template, you can do multiple loops within the template. FWIW, The issue with using $wp_query as a variable was earlier brought up with the lead developer of Event Espresso and his reply was:
// set by theme (or WP or whoever) $var = "banana"; // later on in our code... $original_var = $var; $var = "monkeys"; // do some stuff // reset $var $var = $original_var; // meanwhile back in the theme (or WP or wherever) echo $var; // **should** output: banana
|
|
I completely trust your judgement regarding the variable handling. I am working now to replace the way our third party developer handled this and will use the methods you suggested. Thanks! |
|
To be clear, the judgement/remarks regarding $wp_query belong to the lead developer of Event Espresso, they are not mine. |
|
Understood, I certainly hope this is not going to present any issues. Could you let me know what you think about the version discrepancy I noted before? |
|
That’s likely coming from the options table. |
|
The support post ‘Problem with ESPRESSO_EVENTS shortcode’ 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.