Ajax Load More is available for download from the WordPress Plugin repository.
Frequently Asked Questions
General Questions
We have an Implementation Guide that can help you here… but essentially, it’s a 3 step process:
- Create your
[ajax_load_more]
shortcode - Add the shortcode to your page via the WordPress content editor or directly within a theme template file.
- Load a page with your shortcode in place and watch Ajax Load More fetch your content.
Pro Tip: You can visit the Help section inside the Ajax Load More plugin for a visual guide.
Your server must be able to read/write/create files. Ajax Load More creates the default repeater on plugin activation and in order to modify the output it is required to write to the file as well.
No, Ajax Load More 5.0 removed all JavaScript dependancies including jQuery.
Repeater Template data is saved into a custom table in your WordPress database and written directly to a template (default.php) file within the WordPress uploads directory under the alm_templates folder.
Yes, with the help of the Single Posts add-on.
Yes! it’s really simple with the WooCommerce add-on.
Copy and paste the copy snippet below into your template.
<li class="alm-item<?php if ( ! has_post_thumbnail() ) { echo ' no-img'; } ?>">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( 'alm-thumbnail' ); ?>
</a>
<?php } ?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p class="entry-meta"><?php the_time( 'F d, Y' ); ?></p>
<?php the_excerpt(); ?>
</li>
PHPThe do_shortcode method simply refers to the manner in which a shortcode is added to your website.
<?php echo do_shortcode('[ajax_load_more post_type="work"]'); ?>
PHPdo_shortcode
is a WordPress function that is used to allow shortcodes to be rendered in backend scripts and template files.
When implementing Ajax Load More on archive pages or custom page template you will most likely be required to use this method.
When adding a shortcode through the WordPress content editor to a simple page, you do not need do_shortcode and can use the shortcode as plain text.
This issue appears most often because prior to activating Ajax Load More your theme was not resizing uploaded media to exactly 150x150
as required by the default Repeater Template.
When activated, Ajax Load More adds an image size of 150×150 (alm-thumbnail) to your theme so all future uploads will be resized into proper dimensions for display.
If updating the default repeater to use an image size already in your theme is not an option we recommend using the Regenerate Thumbnails plugin to batch process your previously uploaded media library images.
Note: Don’t forget to back up your site prior to running the thumbnail regeneration process.
Yes, please visit https://connekthq.com/donate/ and you will be redirected to PayPal.
Yes, Ajax Load More has a built-in right-to-left Repeater Template layout. To enable this, add css_classes="rtl"
to your shortcode.
Example Shortcode[ajax_load_more css_classes="rtl"]
The Search Engine Optimization can be used to send a visitor back to the same position they left off. This add-on creates paging URLs as you scroll and provide visitors the ability to use their back browser buttons to navigate back to their previous position.
Developers
Yes, in Ajax Load More 4.1.0, I quietly released a new alm_render
function that provides a method to initiate Ajax Load More without the use of a shortcode.
// page-template.php
$args = array(
'post_type' => 'post',
'posts_per_page' => '6',
'button_label' => 'Show More Posts',
'button_loading_label' => 'Loading...',
'scroll' => 'false'
);
if(function_exists('alm_render')){
alm_render($args);
}
PHPIn the code sample above, I’m passing shortcode parameter values as an $args array.
Note: the parameter values must always be strings. Booleans and/or integer values may have undesired results.
Yes, to access the $post
object you declare global $post;
it at the opening of a Repeater Template.
<?php
global $post;
echo $post->ID;
// ... Rest of template
PHPTo access custom field values in a Repeater Template you must define global $post;
at the top of the repeater and pass the $post->ID
to the custom field function.
The example below illustrates how to access standard post meta fields as well as fields created by Advanced Custom Fields.
<!-- Repeater Template -->
<li>
<?php
global $post;
// Standard
$value = get_post_meta( $post->ID, 'custom_field_name', true );
// Advanced Custom Fields
$value = get_field('custom_field_name', $post->ID);
?>
</li>
PHPYes, Ajax Load More provides various templates variables that are available for use within repeater templates. Please see the Variables section for more details.
Yes, however not out of the box. Ordering by random requires a custom query to be run before the Ajax Load More shortcode – view code sample.
You can remove the alm-thumbnail image size by adding the following snippet to your functions.php.
<?php
// functions.php
function alm_remove_image_size() {
global $ajax_load_more;
remove_filter( 'after_setup_theme', array( $ajax_load_more, 'alm_image_sizes' ) );
}
add_action( 'after_setup_theme', 'alm_remove_image_size', 1 );
PHPYes! Use the no_results_text parameter or the almEmpty
Callback to render a message to visitors.
When zero posts remain in an Ajax Load More query the Load More button will receive a class of .done
.alm-load-more-btn.done {
display: none;
}
CSSYes, in wp-config.php
add the following ALM constant.
define( 'ALM_DISABLE_REPEATER_TEMPLATES', true );
PHPPro Tip: Use the Theme method to load Repeater Templates from your theme directory.
To access the browser querystring parameters inside a Repeater Template you must retrieve and parse the HTTP_REFERER variable of the global PHP $_SERVER array.
<article>
<?php
// https://website.com/?referral=facebook
$url = $_SERVER["HTTP_REFERER"]; // Get referring URL.
$parts = parse_url( $url ); // Parse the URL.
parse_str( $parts['query'], $querystring ); // Get the querystring.
//print_r($querystring); // Array ( [referral] => facebook ).
?>
<div class="details">
<?php the_title( '<h2>', '</h2>' ); ?>
<?php
if ( isset( $querystring['referral'] ) ) {
echo '<p>Referral: ' . $querystring['referral'] . '</p>';
}
?>
<?php the_content(); ?>
</div>
</article>
PHPYes, the Repeater Template directory path is able to be filtered using the alm_repeater_path
hook seen below.
add_filter( 'alm_repeater_path', function() {
return get_stylesheet_directory() . '/ajax-load-more-templates';
});
PHPErrors
To trigger click events on dynamically created content you need to make use of the jQuery .on()
event handler.
$(document).on('click', '.element_name', function() {
console.log( 'button pressed' );
});
JavaScriptThis error can mean you have issues in your Repeater Template or your server is preventing access to wp-admin/admin-ajax.php.
If this error occurs, check the browser console > Network > Response and look for the following error:
Accessing author info via REST API is forbidden.
If this error is present, the All in One WP Security and Firewall plugin is blocking access. This can be resolved in the plugin settings, see this article for more information.
This error usually means there is an extra (or missing) closing div (or other container type) in your Repeater Template. This can cause ALM to lose it’s reference to the load more button.
This error also appears for users running Smush and the Lazy Load component. There is an issue in that plugin that has yet to be resolved which causes display issues in Ajax Load More. The only way to fix the issue is to disable Smush Lazy Loading on the URLs that use Ajax Load More.
This white screen error may appear when a 3rd party JavaScript file calls a document.write function on the Ajax results.
If this is happening, check the Network tab in your browser console to see which scripts are being loaded after the Ajax request.
A Mixed Content Error message will appear in your browser console if the frontend and the backend of the website are not using the same HTTPS
protocol.
Make sure you’re using HTTPS
for both the WordPress Address (URL) and Site Address (URL) fields in WP Admin > Settings > General
.
Add-ons
No, there is not a trial version of any Ajax Load More add-on or Pro available. Please note that there is a 14 day refund policy pending a support request that cannot be resolved. For more information please see the Terms and Conditions.
Yes, you can activate a license on both instances, however your development/localhost website must follow one of the following domain patterns.
- *.wpenginepowered.com
- localhost
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
- *.dev
- *.test
- .*local
- dev.*
- stage.*
- staging.*
- *.wpengine.com
- *.flywheelstaging.com
- *.kinsta.cloud
- *.cloudwaysapps.com
- *.stage.site
- *.myftpupload.com
- *.pantheonsite.io
Yes, to increase/upgrade the number of available license activations, log into your account and then visit Purchase History > {Product} > View Licenses > Upgrades
.
All license upgrades are discounted at a prorated charge where you only pay the difference.
Yes, to update a payment method, log into your account and then visit Account > Subscriptions > Update Payment Method.
Note: Payment methods can only be updated for credit card purchases. PayPal payments can not be updated and you will need to repurchase using the license key as the renewal key.
If you are receiving an unauthorized error when updating an add-on, please try deactivating and then re-activating the license(s) from Ajax Load More > Licenses. Once you’ve done that, try running the update again.
If the issue persists, send us a support request and provide each license key so we can confirm license activations.
Yes, license keys can be added as constants to the wp-config.php of the site.
When adding keys via PHP constants, license activation is still required to be triggered from the Ajax Load More Licenses admin screen in WordPress.
<?php
define( 'ALM_AJAX_LOAD_MORE_PRO_LICENSE_KEY', 'xxxxxxxxxxxxxx' );
define( 'ALM_CUSTOM_REPEATERS_LICENSE_KEY', 'xxxxxxxxxxxxxxx' );
PHPReplace AJAX_LOAD_MORE_PRO
and CUSTOM_REPEATERS
in the constants above with the name of your add-on(s).