Hi Web Togo,
I believe your issue is slightly separate so this workaround sadly doesn’t apply.
My problem lay with BWP Minify + Infinite Scroll leading the jquery.infinitescroll.js to be placed below the init segment:
infinite_scroll = jQuery.parseJSON(infinite_scroll);
jQuery( infinite_scroll.contentSelector ).infinitescroll( infinite_scroll, function(newElements, data, url) { eval(infinite_scroll.callback); });
Inspecting your page – https://moocabier.com.br/new/
I found the order is correct in that the jquery.infinitescroll.js is placed above the call to infinite_scroll.
Your HTML
<script type='text/javascript' src='https://moocabier.com.br/new/wp-content/plugins/infinite-scroll/js/front-end/jquery.infinitescroll.js'></script>
<script type="text/javascript">
window.onload = function() {
// Because the <code>wp_localize_script</code> method makes everything a string
infinite_scroll = jQuery.parseJSON(infinite_scroll);
jQuery( infinite_scroll.contentSelector ).infinitescroll( infinite_scroll, function(newElements, data, url) { eval(infinite_scroll.callback); });
};
</script>
You’ve wrapped it with window onload properly so it’s not that the workaround isn’t in place it’s just unapplicable as there’s another piece missing completely from your DOM.
On my instance – https://myvancity.ca
The Infinite Scroll plugin saves the settings as a json object within a <script> tag named infinite_scroll… which is what the error is indicating as missing.
My Infinite Scroll Settings JSON HTML
<script type="text/javascript">
/* <![CDATA[ */
var infinite_scroll = "{\"loading\":{\"msgText\":\"<em>Loading...<\\\/em>\",\"finishedMsg\":\"<em>No additional posts.<\\\/em>\",\"img\":\"http:\\\/\\\/myvancity.ca\\\/wp-content\\\/plugins\\\/infinite-scroll\\\/img\\\/ajax-loader.gif\"},\"nextSelector\":\".page_nav_wrap .post_nav a.next\",\"navSelector\":\".page_nav_wrap\",\"itemSelector\":\".post\",\"contentSelector\":\"#content\",\"debug\":false,\"behavior\":\"\",\"callback\":\"\"}";
/* ]]> */
</script>
Have you gone into Settings > Infinite Scroll and saved your information?
If so try deactivating and reactivating or installing the plugin over itself via ftp.
If all fails I’d say open another ticket indicating the settings are not being injected into your page. And implement a new workaround, creating the necessary infinite_scroll object manually.
Update the footer.php (in infinite-scroll/templates/)… again.
Placing the following <script> tag above the existing one you updated with the window.onload or merging the two <scripts>
<script type="text/javascript">
/* <![CDATA[ */
var infinite_scroll = "{\"loading\":{\"msgText\":\"<em>Loading...<\\\/em>\",\"finishedMsg\":\"<em>No additional posts.<\\\/em>\",\"img\":\"http:\\\/\\\/myvancity.ca\\\/wp-content\\\/plugins\\\/infinite-scroll\\\/img\\\/ajax-loader.gif\"},\"nextSelector\":\".page_nav_wrap .post_nav a.next\",\"navSelector\":\".page_nav_wrap\",\"itemSelector\":\".post\",\"contentSelector\":\"#content\",\"debug\":false,\"behavior\":\"\",\"callback\":\"\"}";
/* ]]> */
</script>
Update the added code with your selectors:
Content Selector: #blog-content
Navigation Selector: div.nav-links
Next Selector: div.nav-previous a
Item Selector: div.post
<script type="text/javascript">
/* <![CDATA[ */
var infinite_scroll = "{\"loading\":{\"msgText\":\"<em>Loading...<\\\/em>\",\"finishedMsg\":\"</em><em>No additional posts.<\\\/em>\",\"img\":\"http:\\\/\\\/moocabier.com.br\\\/wp-content\\\/plugins\\\/infinite-scroll\\\/img\\\/ajax-loader.gif\"},\"nextSelector\":\".nav-previous a\",\"navSelector\":\".nav-links\",\"itemSelector\":\".post\",\"contentSelector\":\"#blog-content\",\"debug\":false,\"behavior\":\"\",\"callback\":\"\"}";
/* ]]> */
</script>
Hope that’s helpful,
O and of course on plugin update this will revert, hence I’d suggest another ticket strictly concerning your issue of missed infinite_scroll settings injection to notify the plugin developer.