Okay
  Public Ticket #3236145
Portfolio pages aren't loading with AJAX
Closed

Comments

  • Simon Parkinson started the conversation

    Hello,


    I can't quite figure out what I'm doing wrong, but despite AJAX loading being enabled in the WP customiser settings, my portfolio posts don't load dynamically, rather as a standard page refresh. I assume there's something basic I've missed, or a conflict somewhere, but I'd appreciate if you could take a look for me.


    Thanks for your help


    Simon

  •  1,973
    Support replied

    Hello Simon,

    there is an error in the js code whenever you attempt to load the page with ajax and I'm wondering if the child theme code/third party plugin is causing this.

     so if you can enable the main theme and test with ajax on if it behaves the same? if the problem still persists, send us wp admin access in a private comment in order to have a look

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • Simon Parkinson replied

    Ahhh... yes - thank you!

    For some reason loading GSAP in the child theme header.php was kicking up errors and once I'd disabled it, AJAX loading began working as expected. I'll see if I can implement it functions.php instead or else avoid using it entirely.

    I have however encountered another issue you might be able to advise on. I'm using the Cool Timeline Pro plugin (Download Cool Timeline Pro - WordPress #1 Timeline Plugin (coolplugins.net)) on my about page (About - Simon Parkinson). The timeline itself is added via a shortcode block, but on the initial page load it doesn't display on the front end. For some reason, on inspection the element is rendered with opacity: 0 and doesn't appear to pick up the correct styling from the child style.css. Again, I assume this is AJAX related as when you manually refresh the page, the timeline displays as intended.

    Any ideas if there's a workaround for this? If not, are you aware of any similar plugins that might play better with your theme?

    Thanks again for your help.

  •  1,973
    Support replied

    Hello Simon,

    Yes, it's the compatibility between third party plugins and AJAX

    Ajax page transitions will load the target page content 'container' within the original page therefore the <head> and <body> elements will stay the same, regardless.

    Since a lot of plugins are using javascript initialization in the head (or the footer) of the page they don't get called in the target page.

    The solution we found is to put all the extra inits in ajaxSuccess event handler as you can see in the child theme we provide in main archive (I attach it here for your convenience, childscript.js file)

    So if you know what function to call from the plugin API you can add it there.


    Attached files:  bauman-wpbakery-child.zip

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy