Portfolio not loading when using google jquery

Hi see: https://www.logoglo.com/portfolio-page/

I have this code to load googles library (to speed things up)

//Making jQuery Google API
function modify_jquery() {
if (!is_admin()) {
// comment out the next two lines to load the local copy of jQuery
wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’, ‘https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js’, false, ‘1.12.4’);
wp_enqueue_script(‘jquery’);
}
}
add_action(‘init’, ‘modify_jquery’);
//

But the portfolio stops working (hangs on load) when I use it (the code works and loads the jquery, rest of the site works)

I have removed this code for now, as I need the portfolio page working.

IS there a way to load googles jquery, and have the portfolio page work?

Thanks.

Hello @logoglo,

Thanks for writing in!

At the moment, the portfolio items is loading. I guess this is using the default WP jQuery. Please enabled the PHP code in your child theme so that we can investigate any error it is generating when loading the portfolio.

Regards.

Hi, you mean, use the code and have the portfolio not load, while you investigate?

Hi @logoglo,

I’ve tested your very own function code and the Google serve jquery.min.js is working just fine.

I see that you have a JS error on your portfolio page, it has something to do with ReCaptcha, this might be related to your issue.

Please do testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

If the issue persists, please try removing any custom script that you might add that has something to do with ReCaptcha.

Lastly, please Purge Everything on your Cloudflare cache.

Purging cached resources from Cloudflare

Let us know how it goes,
Cheers!

I turned off all plugins, and the issue with the portfolio was still there, if I use googles jquery, the portfolio doesnt load. The re-captchya is disabled on every page that doesnt have contact form 7 on there, to avoid loading unnecessary scripts, I disabled all plugins, and the issue is still there.

How did you test? Like I said, the code works, and the whole site works using googles jquery, but the portfolio breaks.

Is there anyway, using the same code, or adding to it, to exclude the portfolio page from using googles jquery, and use the themes jquery?

Hi There,

He tested it on his install. I tried it to on my install and it is working. It would be best if we can see the error directly. If you could set this code on a staging site that would be better. Then please share the URL so we can investigate the error. Thank you.

How strange, I uploaded the fucntions.php to the staging, and it worked, the portfolio loaded fine…so I uploaded to the live site, and its working fine…MYSTERY.

Hi @logoglo,

Glad it is working now. Maybe it is browser cache or something didn’t load correctly when the error occurs.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.