Skip to main content

How to Add Infinite Scroll to your WordPress Blog

If you want to reduce number of actions that your readers have to take to read articles on your blog, you should consider to add infinite scroll. It is not complicated to add infinite scroll to your WordPress blog and can be done in several minutes.

What is Infinite Scroll

As on Facebook, Twitter or many other websites, infinite scroll is a popular feature that your content will be automatically loaded when users hit the bottom of the page. They no more need to click on pagination to come to next pages but just have to continue to scroll. This feature can help you to keep users on page in longer time.

To add infinite scroll, you can easily find an appropriate WordPress plugin. In this article, we will show you the way to add infinite scroll using Jetpack plugin.

add infinite scroll using jetpack

Step 1: Install and activate Jetpack

As a matter of fact, before using the plugin to add infinite scroll, you need to install and activate Jetpack. If you only want simple infinite scroll feature, you just need to use the free version. Jetpack allows you to install in 1 click just by entering your site address. Alternatively, you can download the Zip file and install the plugin as usual.

>> Read more: INSTALL WORDPRESS PLUGIN IN 2 COMMON WAYS

Step 2: Add Infinite Scroll Using Jetpack Plugin

Enable Infinite Scroll in Supported Themes

Infinite scroll only works with themes that support it. But don’t worry, most themes nowadays have Infinite Scroll support built in already! To check if your theme supports Infinite Scroll, simply activate the Infinite Scroll module under Jetpack -> Settings and check that “Scroll Infinitely” is checked under Settings -> Reading.

If you have a supported theme, just add the following code to your functions.php file:

add_theme_support( 'infinite-scroll', array(

'container' => 'content',

'footer' => 'page',

) );

Enable Infinite Scroll in Unsupported Themes

Developer Tyler Longren offers alternative solution for themes that doesn’t support infinite scroll.

Firstly, activate infinite scroll as normal. Add the following to your functions.php file:

function mytheme_infinite_scroll_init() {

add_theme_support( 'infinite-scroll', array(

'container' => 'content',

'render' => 'mytheme_infinite_scroll_render',

'footer' => 'wrapper',

) );

}

add_action( 'init', 'mytheme_infinite_scroll_init' );

Next, the render parameter specifies a function, in this case mytheme_infinite_scroll_init. This function uses the WordPress loop to load new posts for endless scrolling.

To put this all together, add this snippet to our functions.php file:

function mytheme_infinite_scroll_render() {

get_template_part( 'loop' );

}

Infinite Scrolling is Still Not Working

If you still can’t get infinite scrolling to work, you may want to check out this solution by developer Samuel Wood, aka Otto, which explains how to separate your posts from the WordPress loop so you can enable infinite scrolling. Please be sure you are familiar with using PHP or have someone help you to try this solution.

Related News

How to Install Google Analytics in WordPress

Bet that you are not writing blog on your website for no one. It's important...

How to add widget to sidebar in WordPress

People are talking about retiring your sidebar which has been with almost blogs for years....

How to Change Default Gravatar on WordPress

Implementation of Gravatar is an uprising trend that is being seen on many WordPress Blogs....

Leave a reply