Skip Navigation

[Resolved] Issues with map loading speed and issues with distance value…

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View of custom posts that displays a map with markers, using a distance filter and sorting results by distance. In some cases the distance center is set by a URL parameter, and in others, it is set by a shortcode attribute. I have implemented some custom code in a wpv_view_settings filter to toggle between the shortcode attribute and the URL parameter. In the cases where distance center is set by a shortcode attribute, I am using another custom shortcode to get the User's predicted zip code. That shortcodes an external service to get a predicted zip code based on the User's IP address. The custom zip code service seems to be working correctly, and the results of the View seem to be accurate.

However, in the cases where this zip code shortcode is used to set the View's distance Query Filter by shortcode attribute, the View consistently causes the page generation time to jump by 3 or more seconds. I would like to try to optimize the page load time as much as possible.

Solution: In this case, testing revealed that using the custom zip shortcode inside a wpv_view_settings filter callback was the source of the delay in page generation, for some reason not fully understood. Replacing that shortcode with a hard-coded zip code resulted in a page generation time just a fraction of a second higher than the page without the View present at all.
Optimization of the zip code shortcode is necessary to prevent the latency seen in page generation time.

This support ticket is created 2 years, 8 months ago. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 16 replies, has 2 voices.

Last updated by shawnW-3 2 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#2119331

Okay, I see what you're saying. Hadn't even occurred to me. I've been in the mode of keeping all my functions totally separated. But this does make sense. Alright, let me give it another go.

#2119417

YEAH! I think that was it! Jeez! Even after you said it, I didn't think the difference would be there, but sure enough.

0.2891 Render time for Master
0.25931 Render time for Shortcode View Inside Radius.

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.