The Next Page add-on provides functionality for infinite scrolling multi-page WordPress posts and pages.
Load and display paginated WordPress content on demand using the Page Break block for Gutenberg or the <!–-nextpage–-> quicktag and Ajax Load More.
How It Works
The Next Page add-on uses the Page Break block for the WordPress Block Editor (Gutenberg) or the <!-‒nextpage‒-> Quicktag in the Classic Editor to split the post_content of the current post into multiple pages.
The Next Page add-on dynamically splits the_content() of a page, post or custom post type into unique pages at the location where Page Break blocks or <!-‒nextpage‒-> tags are found and then Ajax Load More provides functionality to infinite scroll the results.
Note: The <!-‒nextpage‒-> tag and Page Break blocks are core WordPress functionality to break content into pages.
As users load additional pages of content, the browser address bar is updated to the page currently in view and pageviews are sent to Google Analytics for tracking – both these options can be turned on or off depending on your requirements.
With the Next Page add-on you can infinite scroll any piece of post content your WordPress site offers.
The default (out of the box) functionality of the add-on.
Automatically split content into pages without requiring <!–nextpage–> quicktags.
Next Page & Paging
Create an intuitive and user friendly slideshow for viewing multi-page posts with Next Page and Paging add-ons.
Display a post preview snippet with a ‘Continue Reading…’ action for the user to view the full article.
Implementing the Next Page add-on is a two-step process of creating the multi-page content and configuring an Ajax Load More shortcode to display the results.
Note: Next Page add-on integrates with the standard WordPress content editor only. Content created via custom fields or rich text widgets cannot be used with this add-on.
Step 1 – Create Multi-Page Content
The first step is to create a page or post with some paginated content – if you’ve already done this, skip ahead to Step #2.
The Gutenberg (Block editor) and the Classic Editor are both supported by the add-on, however the implementation steps vary for each editor so please read below for instructions on how to create multi-page content.
Classic Editor users must switch the content editor to the Text tab and place <!-‒nextpage‒-> tags where the page breaks should appear in the content.
For every <!-‒nextpage‒-> instance found Ajax Load More will split the content into pages and load the content via infinite scroll.
Note: The <!-‒nextpage‒-> tag must be added to the content editor via the Text tab (as seen above) and will display as a page break in the Visual editor.
Step 2 – Adding the Shortcode
The last step is to add or configure your custom Ajax Load More shortcode, the Next Page add-on provides two unique methods for doing so.
The Post Type implementation allows for Next Page functionality to be enabled automatically on specific post types, while the Template implementation allows for more granular control of where and when the functionality is enabled.
The Next Page add-on provides a Post Type implementation method where all plugin configuration and setup is handled via global Ajax Load More settings.
This method allows users to automatically enable Next Page functionality on a per Post Type basis and requires absolutely zero template modification or custom configuration outside of the plugin settings page. Ajax Load More will automatically inject Next Page functionality into the single template for selected Post Types.
Access the plugin configuration settings by visiting Ajax Load More > Settings > Next Page in your WordPress admin.
Once on the setting screen, follow the steps below:
- Select the post type(s) to activate Next Page functionality.
- Enter the custom Ajax Load More shortcode for each template.
Note: As a fallback, should you not enter a shortcode, Ajax Load More will set a basic [ajax_load_more nextpage="true"] shortcode.
When a Post Type is selected, Next Page functionality is injected automatically into the single template for the Post Type and no further set up is required.
It’s possible to enable Next page functionality on specific posts in a post type by passing the required taxonomy query params directly intto the shortcode.
[ajax_load_more nextpage="true" taxonomy="actor" taxonomy_terms="chris-rock, will-smith"]
The shortcode example above with render Next Page functionality only when chris-rock or will-smith taxonomy terms are associated with a post.
For users who want to control exactly where the Next Page functionality is enabled, the add-on can be implemented via backend code using WordPress templates. With this implementation method, the Ajax Load More shortcode is required to be added directly to a PHP template using the core WordPress function, do_shortcode.
The Ajax Load More shortcode should replace the_content() of the page only as no other content or elements will be affected by the Next Page add-on.
* Template Name: My Next Page Template
* Replace the_content() function in the WordPress loop with the [ajax_load_more] shortcode.
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<p class="meta"><?php the_date('F d, Y'); ?></p>
<?php // the_content(); ?>
<?php echo do_shortcode('[ajax_load_more nextpage="true" pause="true" pause_override="true" button_label="Next Page"]');
<?php endwhile; endif; ?>
<?php get_footer(); ?>
In the code sample above, the_content() function used to render the page content has been replaced with an Ajax Load More shortcode.
The following shortcode parameters are available with the Next Page add-on.
|nextpage||Enable the infinite scrolling of multi-page WordPress content (true/false). Default = ‘false’|
|next_post_id||The ID of the current page/post. *required|
|nextpage_urls||Update the browser address bar as pages come into view. (true/false). Default = ‘true’|
|nextpage_pageviews||Send pageviews to Google Analytics. (true/false). Default = ‘true’|
|nextpage_scroll||Scroll users automatically to the next page. (true/false:scrolltop). Default = ‘true:30’|
|nextpage_title_template||The title template is used to update the browser title each time a new page is loaded.|
The following screenshot illustrates the process of building a Next Page shortcode using the Shortcode Builder.
[ajax_load_more nextpage="true" nextpage_urls="true" nextpage_scroll="true:50" nextpage_post_id="'.get_the_id().'" pause="true" pause_override="true" scroll="false"]
Note: If using the Template Implementation the Next Page shortcodes must be added using the do_shortcode method of shortcode implementation.
Upon purchase of this add-on you will receive a confirmation/purchase receipt email. Your receipt will contain a direct link for downloading your copy of Ajax Load More: Next Page and a license key.
After downloading the add-on, upload the unzipped files to your /wp-content/plugins/ directory or visit your plugins dashboard and upload the downloaded .zip under Add New.
To activate your add-on and receive updates directly in your WordPress plugins dashboard users are required to enter the license key that was included with their purchase receipt.
To activate a license key:
- Visit the Licenses section within the Ajax Load More plugin.
- Enter the product key and click Activate License.
- If the status indicator turns green your add-on has been successfully activated (example below).
If you did not receive your confirmation/purchase receipt email and license key, please check your spam/junk folder and if you still cannot locate the email please contact me at darren [at] connekthq.com or use the Product Support form on the website.