Results Text
Providing users with pagination context in Ajax Load More queries
In this example:
Ajax Load More will display the total number of posts loaded and the total number of posts available to the user.
By adding the following HTML element to a template or page, Ajax Load More will render pagination information for users that provides context on the amount of content available.
<div class="alm-results-text"></div> <!-- Renders: Viewing 4 of 18 results. -->
HTML-
Ajax Load More 7.0
Refactoring Ajax Load More for the future.
-
Tracking Pageviews with Google Analytics 4
Measuring page views automatically with GA4 and Ajax Load More.
Use the alm_before_button
hook to inject the Results text HTML.
add_filter( 'alm_before_button', function () {
if ( is_page( 'results-text' ) ) {
return '<div class="alm-results-text" style="text-align: center; padding-bottom: 10px;"></div>';
}
}
);
PHPThe following shortcode was used to create the Results Text example.
[ajax_load_more preloaded="true" preloaded_amount="2" posts_per_page="2" scroll="false" pause="true" repeater="template_46" button_label="Load More" button_loading_label="Loading..." layouts="true" layouts_cols="2"]
The following Repeater Template was used to create the Results Text example.