• Resolved Eusebito

    (@eusebito)


    hi !
    Great plugin, it works fine on one of my website so I installed it on a second one.

    I have setup the plugin to load Disqus on scroll without short code and it doesn’t work. It works perfectly with the on click button and, weirdly, it works on scroll when I load a page with a “#comment-…” at the and of the url. But nothing when I load a page the most normal way.

    I didn’t notice before, so I thought it was the last update, but even with the 8.0.7 the on scroll doesn’t work.

    So, if you have some insights, thanks for your help.

    https://www.ads-software.com/plugins/disqus-conditional-load/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Joel James

    (@joelcj91)

    Hi Eusebito,
    Thanks for the feedback. Definitely I will help. Can you share a screenshot of conditional load settings tab?
    Normal comments will load if you add “#comment-“. This is because if someone try to access your comments directly with comments id, if you are using lazy load it will not load. That is why I have added that option.

    Thread Starter Eusebito

    (@eusebito)

    You are fast !

    This is a screenshot of what’s checked on the setting tab.

    Thanks for your help.

    Thread Starter Eusebito

    (@eusebito)

    Sorry for the waste of time, I found the source of the problem. I put Jquery in the footer instead of the header.

    Thanks anyway, your plugin is great.

    Plugin Author Joel James

    (@joelcj91)

    Thanks. So everything works fine right? Let me know If you have any suggestions. Please rate this plugin if you like.

    Is there any way to get this working with jQuery loading in the footer?

    Could the Disqus related scripts being rendered by the plugin not be enqueued in the footer instead of being rendered where the comments are being rendered?

    Plugin Author Joel James

    (@joelcj91)

    Did you try output javascript in footer option in disqus settings?

    Hey,

    Yeah, I tried that but there was still a jQuery call being rendered at the same place as the comments HTML.

    As soon as I moved scripts to header it started working.

    Note that this is an issue for me because I’m forcing jQuery to be loaded in the footer

    I have my own script being placed in the footer with

    wp_register_script('scripts', get_stylesheet_directory_uri() . '/assets/js/' . $scripts, ['jquery'], FALSE, TRUE);
        wp_enqueue_script('scripts');

    And then I’m forcing all other scripts to be loaded in the footer with the following:

    function pa_footer_enqueue_scripts() {
    	    remove_action('wp_head', 'wp_print_scripts');
    	    remove_action('wp_head', 'wp_print_head_scripts', 9);
    	    remove_action('wp_head', 'wp_enqueue_scripts', 1);
    	}
    	add_action('wp_enqueue_scripts', 'pa_footer_enqueue_scripts');

    But certainly for speed reasons it would be great to be able to fully shift jQuery loading to the footer.

    When I have the above two running, I get

    Uncaught ReferenceError: jQuery is not defined

    Which is happening shortly after the rendering of #disqus_thread where an inline script fires:

    jQuery(function () {
        jQuery("#js_comment_div").click(loadDisqus);
    });
    Plugin Author Joel James

    (@joelcj91)

    Hey Alex,

    Currently we do not have that option. But I will consider that in future updates. And I think there are now external scripts loaded by default when using this plugin. So does it matter a lot?

    Hey Joel,

    Thanks for the reply. For the time being I’ll just keep the enqueued scripts in the head, but I guess if any of the inline scripts loaded by the plugin were enqueued instead of rendered in place, then they could also be moved to the footer by my footer_enqueue function.

    Unless it’s something that’s happening as a result of the ‘on click’ loading, but perhaps that could append any scripts to be loaded just before the closing </body> tag.

    The other thing I could do I guess is manually hardcode jQuery to be loaded via a CDN in the head and remove jQuery from enqueue and move all the other scripts to the footer. That way I’d only have one script being loaded in the header, and all others would be pushed to the footer.

    Thanks!
    Alex

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Doesn't Load on Scroll’ is closed to new replies.