Support

Home Forums Multiple Event Registration Add-on Two [ESPRESSO_TICKET_SELECTOR]'s on different pages

Two [ESPRESSO_TICKET_SELECTOR]'s on different pages

Posted: December 18, 2016 at 10:39 am

Viewing 6 reply threads


Stichting Festival Aangeschoten Wild

December 18, 2016 at 10:39 am

Hi,

I’m currently running into a particularly weird problem when trying to display ticket selector’s using EE4. I have two events and would like to attendees to register for these events on two separate pages. When I save page A with shortcode for event 1, that works. When I save page B with shortcode for event 2, that works as well. However, upon saving page B, the shortcodes on page A get disabled.

I’ve tried to use the equivalent php-functions combined with template files, but that yields exactly the same problem: the shortcode showing up in plain text, and no ticket selector form.

Any help is much appreciated! I’m running a quite complicated WordPress installation so the above might be caused by plugin conflict, but would like to hear that the behaviour I’m seeing is not by design before I start full-fledged debugging.

Kind regards,
Bram Peerlings


Tony

  • Support Staff

December 19, 2016 at 4:43 am

Hi Bram,

So just to confirm this setup, you have 2 pages, Event A and Event B.

Event A page has the [ESPRESSO_TICKET_SELECTOR event_id=111] shortcode.
(assuming the ID for Event A is 111)

Event B page has the [ESPRESSO_TICKET_SELECTOR event_id=222] shortcode.
(again assuming the ID for Event B is 222)

However when saving Event B the Event A page stops parsing the shortcode? If so then no that is not by design.

Are you using any kind of page builder within the theme?

I’ve tried to use the equivalent php-functions combined with template files, but that yields exactly the same problem: the shortcode showing up in plain text, and no ticket selector form.

Which functions do you mean? do_shortcode() wrapping the same shrotcodes as above?


Stichting Festival Aangeschoten Wild

December 19, 2016 at 7:26 am

Hi Tony,

Thanks for getting back to me so soon, and glad to hear that this at least isn’t by design. I’m not using a page builder, although I’m using the shortcodes wrapped (nested) in other shortcodes. I believe I’ve checked what happens if I don’t wrap the EE-shortcode in another one (didn’t make a difference), but I’ll try again later today to confirm.

Regarding my setup, that’s quite complicated, and far from what is supported and supposed to work out of the box. Most notably, I’m running a WP Multisite installation with EE4 active on two sites (one live, and development). To add to the fun, we’re using WPML to serve multilingual content. (This has also caused very minor adjustments to EE Core, but I’ve confirmed that these edits don’t interfere with the shortcodes.) On the bright side: there’s no page builder involved!

Regarding the PHP-functions, I’ve tried both using do_shortcode() and (off the top of my head) espresso_ticket_selector(id).


Stichting Festival Aangeschoten Wild

December 19, 2016 at 3:37 pm

Just confirmed: wrapped shortcodes don’t make a difference.


Josh

  • Support Staff

December 19, 2016 at 5:42 pm

Hi Bram,

It sounds like the post short code tracking option on your site is broken. Do things improve if you go to Event Espresso > General Settings > Critical Pages and you re-save that settings page?


Stichting Festival Aangeschoten Wild

December 19, 2016 at 11:17 pm

Hi Josh,

Thanks for your suggestion. I’ve just re-saved that page, but didn’t see a difference. I’ve checked both directly after saving the options, as well as first saving the options and then saving the pages again.

Could you maybe tell a bit more on how that tracking option works exactly? I’d assume it would just scan the_content(); for shortcodes and replace them with other code (as usual), but your reply leaves me under the impression that EE does things a little differently.

Thanks!


Josh

  • Support Staff

December 20, 2016 at 7:39 am

If it worked the way you describe, then EE would either need to load all the scripts and styles for every short code on every page, or load those assets after the_content(), which unnecessarily slow down the load time of all of the pages on your website. The docblock from the parse_post_content_on_save() method explains a bit:

* any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
* and then track what posts those shortcodes are on, so that we can initialize shortcodes well before
* the_content() runs. this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the
* shortcodes are actually used on

You can follow the code in the parse_post_content_on_save() method located in /core/admin/PostShortcodeTracking.php then also check the ee_config option in your site’s database.

At this point I can only guess, but I wonder if there are additional posts IDs being thrown into the mix with the way that multilingual content is being served?

Viewing 6 reply threads

The support post ‘Two [ESPRESSO_TICKET_SELECTOR]'s on different pages’ 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