How do you tell a section of PHP code to load after everything else loads first?

PHP is a server-side language, which means that it typically must run before the page loads.

If the speed is due to the api itself, there’s not much we can do.

However, I expect that the speed hit is because of the images. In this case, we could - for example - store the search results in a temporary XML or JSON file, or even a session cookie, and provide the results with JS / AJAX after the rest of the page has loaded.

I see a ‘lazy’ class in the markup, so you’ll want to make sure your solution doesn’t break the lazy-load function. I would also check to make sure the lazy-load is already working, before you start tinkering (a broken lazy-load could be the reason it’s going so slow).

1 Like