Passo 1. Procure o arquivo comment_embed.js
1 |
/wp-content/plugins/disqus-comment-system/public/js/comment_embed.js |
Passo 2. Adicionar JS
Substitua por:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
// Lazy loading Disqus comment scripts (function() { var scrolled = false; if (/bot|googlebot|crawler|spider|robolazyt|crawling/i.test(navigator.userAgent)) { lazy_load_disqus(); } jQuery(window).on('scroll', function() { if (scrolled === true) { return; } scrolled = true; lazy_load_disqus(); }) })(); function lazy_load_disqus() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); } |
Referência: https://www.aimeesign.com/articles/how-to-set-disqus-lazy-load-wordpress-solved/