Navigation überspringen

[Gelöst] How to delay shortcode execution after page load?

This support ticket is created vor 4 Jahre, 5 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zeitzone des Unterstützers: Asia/Karachi (GMT+05:00)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von himanshuS vor 4 Jahre, 5 Monaten.

Assistiert von: Waqar.

Author
Artikel
#1941305
time.png

One of the pages on my site has more than 20 shortcodes from toolset. The page takes a lot of time as all shortcodes need to fetch data before the page loads.
I was wondering if there is a way to delay executing shortcodes until after the page loads. That way, user can start working on the page and the data is fetched parallelly by the shortcode, This will improve the user experience as they won't have to wait for as long as 16 seconds.

In summary, is there a way to lazy load toolset shortcodes so that user does not need to wait for the code the execute?

Image with delay uploaded.

#1941857

Hi,

Thank you for contacting us and I'd be happy to assist.

There is no built-in feature available in Toolset to delay the loading/execution of shortcodes. I also couldn't find any other plugin online which can help with the lazy loading of content from shortcodes.

To achieve something like this through custom code, you'll have to make use of the WordPress AJAX feature, and here are some useful resources on the topic:

versteckter Link
https://wordpress.stackexchange.com/questions/249929/load-content-in-a-div-with-ajax

For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#1941873

Thank you, Waqar!

#1941875

My issue is resolved now. Thank you!