The Single Posts add-on will enable infinite scrolling of complete posts on WordPress single post templates.

Quickly enable core Ajax Load More functionality on standard posts & custom post type single templates as well as update the browser URL when additional posts come into view – view example.

How It Works

The Single Posts add-on works by using Ajax to append the previous post (in chronological order) to the Ajax Load More container as a user scrolls your website.

By utilizing core WordPress functions such as get_previous_post(), get_next_post() and get_the_ID(), the add-on will retrieve the upcoming post ID and then hook into Ajax Load More for the display and rendering of post data.

Note: At minimum, some WordPress development knowledge will be required to implement the Single Post add-on on your website. If you are unsure of how to implement or have questions regarding implementation please contact us prior to purchasing.

URL Updates

When upcoming posts are loaded and come in to view, the browser address bar will update to the URL of the post currently in view.

Previous Post Update Url

This functionality is important for users who decide to share a specific post that has been loaded via infinite scroll.

🔥  Did you know: You can Cache single posts to improve site performance!


Implementation

Implementing infinite scroll on a single post template is essentially a two step process.

Step 1

Create a new Repeater Template that will be used specifically for your single post display. This template will include core WordPress functions such as the_title() and the_content(). In most cases the content of the template will be a direct copy and paste from an existing theme template (e.g. single.php).

Previous Post Repeater Template

Step 2

Add the Ajax Load More shortcode directly to your single template .php file using the WordPress function, do_shortcode as seen in the example below.

Note: Ajax Load More will take care of loading ALL posts, including the initial post when a user lands on the page. All that should remain in your single.php loop is the ajax_load_more shortcode (as seen above).


Shortcode Parameters

The following shortcode parameters are enabled then the Single Posts add-on is activated.

single_post Enable the infinite scrolling of single posts. Default = ‘false’
single_post_id The current post ID to pass to Ajax Load More. Default = ‘get_the_ID()’
single_post_order Select the load order of posts while infinite scrolling. Default = ‘previous’ (by date DESC)
single_post_taxonomy Query posts from the same taxonomy. Default = null
single_post_excluded_terms Exclude posts by term ID from the post query. Default = null

Note: The single_post shortcode parameters should only be used on single post templates – attempting to implement elsewhere is not recommended.

Shortcode Builder

The following screenshot illustrates the process of building a Single Posts shortcode using the Ajax Load More shortcode builder.

Single Posts Shortcode Builder settings.

Example Shortcode[ajax_load_more single_post="true" single_post_id="'.get_the_id().'" post_type="post"]

Post Ordering

Single Posts provides users the ability to control the ordering of the upcoming posts by selecting one of the following parameters when implementing an Ajax Load More shortcode.

Single Posts ordering in Ajax Load More

Previous Post (Default)

Selecting the previous option will load posts by date in chronological order using the WordPress core function, get_previous_post() – view example.

Example Shortcode[ajax_load_more single_post="truesingle_post_order="previous"]

Latest Post

Selecting the latest option will load the latest (newest) post by publish date and continue loading posts by date in chronological order – view example.

Example Shortcode[ajax_load_more single_post="truesingle_post_order="latest"]

Next Post

Selecting the next option will load posts by date in reverse chronological order using the WordPress core function, get_next_post() – view example.

Example Shortcode[ajax_load_more single_post="truesingle_post_order="next"]

Post ID Array

The single_post_order shortcode parameter will also accept an array of comma separated Post IDs. This allows users to be very specific about which posts are shown in the infinite scroll list.

The shortcode below will load 5 additional posts after the initial post – view example.

Example Shortcode[ajax_load_more single_post="truesingle_post_order="1534,1540,1541,1562"]

Comments

The out of the box WordPress comments are fully supported and should function as intended with Ajax Load More, however some 3rd party commenting systems require workarounds when being integrated with Ajax.

Disqus

The Single Posts add-on has a custom built-in solution for loading Disqus comments with Ajax.

To enable support for Disqus commenting, simply add an empty .alm-disqus HTML element to your repeater template in the location you wish comments to appear – on the empty element you must also pass in your Disqus shortname as a data attribute (as seen in the example template below).


Configuration

The following configuration options will be available on the Ajax Load More Settings screen immediately following installation.

Updating Single Posts settings in Ajax Load More


Installation

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: Single Posts 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.

License Activation

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:

  1. Visit the Licenses section within the Ajax Load More plugin.
  2. Enter the product key and click Activate License.
  3. If the status indicator turns green your add-on has been successfully activated (example below).
License Key Example

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.