Infinite Scroll not working (button instead of auto load)

I’m using Sparkling theme + Jetpack enabled and Infinite Scroll is not working. Besides, even your demo page doesn’t have infinite scroll.

Previously, with WP’s Fifteen Theme everything worked, but now with Sparkling, instead of an infinite scroll there’s a “Load more posts” button. Infinite scroll works when a visitor is scrolling and the next posts are automatically loaded, no buttons/clicks involved.

I already changed “click” method to “scroll” inside jetpack.php without any luck. Can you provide an answer similar to the one you gave to Tavelify theme but now for the Sparkling theme?

My website: www.estudarinformatica.info

Help? Please?

Hi @loop1loop,

I hope you are well today and thanks for your patience here.

Could you please just try using the attached small plugin containing the following code to achieve it?

function custom_sparkling_jetpack_setup() {
	add_theme_support( 'infinite-scroll', array(
		'type'      => 'scroll',
		'container' => 'main',
		'footer'    => 'page',
	) );
}
add_action( 'after_setup_theme', 'custom_sparkling_jetpack_setup', 99 );

Best Regards,
Movin

Sorry for taking so long to reply to your solution attempt and thanks for giving me a code snippet.

However it didn’t fix the behavior. You can see for yourself at http://www.estudarinformatica.info/

What else can we do?

Hi @loop1loop,

I have tested the shared solution on my test site using latest version of Sparkling theme & Jetpack plugin and the shared solution worked fine for me without any issue.

I checked the markup of your site and i didn’t find the shared Colorlib Plugin markup there.

Could you please make sure that you have installed the shared Colorlib Plugin and latest versions of Sparkling theme & Jetpack plugin?

Or have you used the provided solution using any other way?

Kind Regards,
Movin

I’m using the latest version of Jetpack and updated my Sparkling theme to v2.0.1

I went to Wordpress’ sidebar > Appearance > Editor and selected the jetpack.php file, as suggested by Colorlib’s support here, located at sparkling/inc/jetpack.php.

I replaced the existing code

<?php
/**
 * Jetpack Compatibility File
 * See: http://jetpack.me/
 *
 * @package sparkling
 */

function sparkling_jetpack_setup() {
	add_theme_support( 'infinite-scroll', array(
		'type'      => 'click',
		'container' => 'main',
		'footer'    => 'page',
	) );
}
add_action( 'after_setup_theme', 'sparkling_jetpack_setup' );

with the code solution you provided.
What else can I do?

Hi @loop1loop,

Please revert any changes that you have made in the Jetpack plugin or just delete the Jetpack plugin and install the fresh version of it then try using the shared plugin as it is without changing anything.

If it doesn’t work then this can be due to plugin conflict on your site so please try temporary deactivating all plugins and see whether everything works fine and then enable the plugins one by one to see which plugin is conflicting if any.

Regards,
Movin

Well, I thought your code should be placed inside the jetpack.php file. Now I’m confused.

I reverted my changes to jetpack.php and updated Wordpress Jetpack to v3.8.0

Please explain me clearly step-by-step what I need to do with the code your provided.
Where do I insert/paste it? Which file?

Thanks

Hi @loop1loop,

You don’t have to add the provided code anywhere. You have to just install and activate the colorlib plugin provided in my following reply.

https://colorlibsupport.com/t/infinite-scroll-not-working-button-instead-of-auto-load/#post-29981

You will find information about how to install and activate WordPress plugin on the following page.

Best Regards,
Movin

I uploaded your ZIP to my Wordpress’ plugin folder and activated it.

When I press the “Load more posts” button, it disappears and nothing happens. With or without other plugins (see attachments)

I’m starting to doubt I will ever have this functionality. I’m spending way too much time on this.

Hi @loop1loop,

Thank you for your patience here.

After using the provided custom plugin, please make sure that you have selected the jetpack plugin option “Scroll Infinitely” in the admin area of your site reading setting on the following path as shown in the attached screenshot.

Admin Area -> Settings -> Reading

Regards,
Movin

IT’S WORKING, IT’S FINALLY WORKING!
Thank you so much Movin.

I went to that configuration and it was disabled saying that the theme’s default behavior was click-to-load.

Then I re-enabled your plugin and that config was enabled. I checked it, saved it, purged page cache, and it started working.

You have my deepest gratitude.

You are most welcome here :slight_smile: