Single Posts

Developer documentation for the Ajax Load More Single Posts add-on.


Frequently Asked Questions

Below are common questions regarding the Single Posts add-on. If you have a question and don’t see an answer here, please visit the support page and submit your request.

How can I display comments with Ajax loaded posts?

If you are having trouble displaying your comments template on the posts loaded via Ajax try adding the following $withcomments code above the call your function call to comments_template().

Why are animations and other functionality within my single post not working when using this add-on?

Any content element that requires JavaScript and has been loaded dynamically (with Ajax) will most likely need to be initiated after a successful Ajax request.

Examples of content that may require JavaScript initiation are:

  • Social sharing plugins
  • Facebook Comments
  • Disqus Comments
  • Slideshows
  • Lightbox Galleries
  • etc…

Please have a look at the almComplete() callback function – this callback is triggered after every successful Ajax Load More query and will allow you initiate functionality as content is loaded.

Why are shortcodes rendering as plain text in my posts?

If shortcodes are rendering as static text and not parsing in ajax loaded posts you may need to run a filter in your repeater template on the_content() function.


Visual Composer

Visual Composer users are required to execute WPBMap::addAllMappedShortcodes() prior to calling the_content() in an Ajax requests – see the example below:

Why are Facebook comments not showing up?

Facebook comments require javascript to initiate so you will be required to use the almComplete() callback function to load the comments.

If a post has multiple categories can I still query posts from the same taxonomy?

Yes, but please be aware that if you set a single_post_taxonomy value in the shortcode and the current post has multiple terms assigned, Ajax Load More will look for posts where ANY of the assigned terms are present.

Note: Setting a primary category or term does not affect a post query – this is out of the box WP functionality that cannot be adjusted.

Posts are loading before users reaches the bottom of the page, what gives?

This issue can arise if you have floated elements in your repeater template.

For example, your main post container has a float: left; CSS property assigned – this may cause the positioning of the load more button to become unreliable and cause posts and URLs to update prematurely.

A solution to this problem is to ensure your floated elements are always cleared by assigning the following CSS to the .alm-reveal container.

.alm-reveal{ overflow: hidden; }

Jetpack Sharing is not working in Ajax, how can I fix this?

Jetpack Sharing disables itself in Ajax requests that are not named ‘get_latest_posts‘.

To fix this you will need to modify the core Sharedaddy module within Jetpack.

Open plugins/jetpack/modules/sharedaddy/sharing-service.php and goto line 754:

Remove the ¬†&& ‘get_latest_posts’ == $_REQUEST[‘action’] ¬†portion of the PHP conditional.

Here is what the updated code should look like:

Note: Modifying core plugin means that whenever the plugin is updated these changes will be lost.

Why is content after <!-- more --> shorttags not displaying?

This happens in some themes and frameworks because of the way the templates have been structured. To fix this issue add the following code snippet to the start of you Repeater Template.

Are there any themes the Single Posts add-on is not compatible with?

There are not any particular themes we can say are 100% incompatible with Ajax Load More however, the themes listed below will require advanced level modification to multiple files.

Is Divi page builder supported?

Unfortunately Divi by Elegant Themes is not supported by the Single Posts add-on. The issue revolves around Divi grid/column shortcodes rendering as plain text in admin-ajax requests – this has yet to be resolved with Divi support.

For those that are using Divi, we recommend using our other infinite scroll plugin, Post Explorer.


« Back to Add-ons