A query loop that matches two hundred posts has to show some of them first. Everything after that is a decision about how the visitor reaches the rest: numbered pages, a Load more button, or infinite scroll that fetches the next batch as they scroll. Bricks Builder supports all three, through a Pagination element, a Load more interaction and an infinite scroll setting on the loop, and you can also write your own. Each one looks like a small interface choice and behaves like a much larger decision about URLs, search engines, keyboard users and server cost.
The single most important idea in this tutorial is that pagination is a URL problem before it is an interface problem. Page two of a list should be an address that works on its own: in a new tab, in a search engine, for a person with a script blocker, and on the day your JavaScript fails. Load more and infinite scroll are layers on top of that address space. When a layer works, visitors get a smoother experience. When it fails, the numbered pages underneath are the safety net. Sites that treat the layer as the whole feature end up with content that crawlers and some visitors cannot reach.
The second idea is that every extra batch is a real server render. When a visitor clicks Load more, a request reaches your server, which rebuilds that loop for the next page and returns HTML. The cost is the same query you already pay for page one, paid again for each batch. That is why the per-page value, the sort order and caching matter more than the colour of the button.
The tutorial walks through the choice and then the build. It starts by comparing the patterns, explains what Bricks does when a visitor asks for more, builds the numbered baseline and sets the loop options that keep any pagination correct, such as a stable sort and the main query setting. It then covers the native Load more and infinite scroll features, including the JavaScript events they fire, followed by the search and accessibility consequences. The second half is a complete, original vanilla JavaScript Load more script that enhances the real pagination links, with the matching CSS, a rendered preview, an infinite scroll mode with a cap, and a closing section on caching, Core Web Vitals and the failures people report most.
A few honest boundaries. This is a general guide based on the public Bricks documentation, not a hands-on test report of Bricks, and it contains no benchmark numbers. Control names, events and hooks were checked against the Bricks Academy at the time of writing. Where an exact label could not be confirmed, the text tells you what to look for in the interface instead of guessing. The custom script is written for current browsers and for the markup described in this guide, so check it against your own page structure before relying on it. Bricks changes between versions, and the current Bricks documentation is the final word where it disagrees with any article, this one included.
Key points
- Pagination is a URL problem first: keep real links to numbered pages, and treat Load more and infinite scroll as layers on top of them.
- Bricks fetches more items by asking the server to render the next page of the same loop, so every batch costs the loop’s query again; choose Posts Per Page and caching with that in mind.
- Make any pagination correct before styling it: a stable sort with the post ID as a tiebreaker, No Found Rows off for paginated loops, and the right main query setting on archives.
- Bricks offers a Pagination element, a Load more interaction and infinite scroll; they depend on the loop’s element ID and on the loop comments in the HTML, so keep both intact.
- Search engines follow links, not clicks or scrolling, and accessibility needs focus handling, a live count and a reachable footer, so cap infinite scroll or finish it with a button.
- A small vanilla script can enhance the real next-page link: fetch it, pick the items, append them without duplicates, swap the pager, announce the result, and handle the last page and errors.
Four patterns, one question: how does a visitor reach item thirteen?
Before touching a setting, decide what the visitor is trying to do, because that decides the pattern. There are really three patterns, and a fourth that is a variation. Numbered pagination shows page links and loads a whole new page of results. Load more keeps the current items on screen and adds the next batch when the visitor asks. Infinite scroll adds the next batch automatically when the visitor nears the end of the list. The variation is AJAX pagination, which keeps the numbered links but swaps the results without a full page reload.
Numbered pagination suits people who compare, go back, jump to a specific place or want to share an address. A blog archive, a search results page and a reference list all belong here, because visitors say things like “it was on page four”. It is also the only pattern that is a plain set of links with no help from JavaScript, which makes it the strongest for search engines. Load more suits browsing: a product grid, a portfolio or a magazine front where the goal is to see more of the same without losing your place. The visitor stays in control, the footer stays reachable, and the pattern degrades well when it sits on top of real links. Infinite scroll suits casual, low-stakes feeds where nothing below the list matters, such as an image stream. It is the hardest to make accessible and the easiest to make unreachable for crawlers and for anyone who needs the footer.
The comparison below puts the trade-offs side by side. Read the row about the address of page two first. It is the row that decides whether a pattern is safe, because only numbered pagination gives page two an address by default; the other two only do if you keep real links in the page and build the script on top of them, which is exactly the approach used later in this tutorial.
A practical rule falls out of this. Pick numbered pagination when the list is a destination, Load more when it is a browse surface, and infinite scroll only when you can cap it and offer a button after a few batches. If you are unsure, start with numbered pagination, because it never fails, and add Load more later as an enhancement. Going the other way, from a script-only pattern to real URLs, means rebuilding the list.
Pagination patterns side by side
| Numbered pages | Load more button | Infinite scroll | |
|---|---|---|---|
| Address of page two | Its own URL by default | Only if real links stay in the page | Only if real links stay in the page |
| Visitor control | High: jump to any page | Medium: asks for each batch | Low: loads automatically |
| Reaching the footer | Always | Always | Hard without a cap or a button |
| Back button and reload | Predictable | Returns to the first batch | Returns to the first batch |
| Search engine discovery | Strong: plain links | Depends on kept links | Depends on kept links |
| Best fit | Archives, search, reference lists | Product grids, portfolios, magazines | Short feeds and image streams |
What Bricks does when a visitor asks for more
Understanding the mechanism makes every later problem easier to diagnose. A Bricks query loop is identified by the element ID of the loop element. On the front end that is usually the six-character ID without the prefix, so a loop element with the ID brxe-abc123 has the query ID abc123. The Pagination element, the filter elements and the AJAX features all connect to a loop through that ID, which is why the Bricks documentation recommends giving loop elements descriptive names so you can find them in the target lists.
The second piece of the mechanism is a pair of HTML comments. Bricks writes markers such as brx-loop-start followed by the loop ID into the page around the loop’s output. The documentation says these comments are essential for AJAX pagination, query filters, Load more and infinite scroll to function, and that some performance plugins remove all HTML comments by default, which breaks those features. Keep the comments. If an optimisation plugin has an option to strip HTML comments, exclude the Bricks markers or turn it off.
When a visitor clicks a Load more button, scrolls to the end of an infinite scroll list or clicks an AJAX pagination link, the Bricks script sends a request to the server asking for the next page of that loop. The documentation names the endpoint as a load query page route and lists the data the server receives, including the loop’s element ID, the current post ID, the page number and the query variables. Bricks rebuilds the loop with the same settings for the requested page, renders just the loop items, and returns them. The script then adds the new nodes to the page, updates its own state and fires events that your own code can listen for. If the page just fetched was the last one, Bricks hides the Load more button using a CSS class, which a Bricks team member described on the support forum as the class brx-load-more-hidden.
Three consequences follow. First, the server pays for a full loop query on every batch, so a heavy loop is heavy again on each click. Second, anything that changes the loop between requests, such as a new post being published or a non-deterministic sort, can show the visitor duplicates or skip items, which is why the next sections spend time on sorting. Third, because the request is built from the loop’s own settings and the ID, anything that stops the request from reaching the server, such as a firewall rule on the REST API or a cache rule on the route, stops the feature. Reports on the Bricks forum show this as a failed request in the browser’s network panel; if Load more does nothing, that panel is the first place to look.
How a native Bricks batch is fetched
- Visitor actionA click on Load more, or scrolling near the end of an infinite scroll list.
- Bricks reads the stateThe loop ID, the next page number and the loop settings the page already holds.
- Request to the serverAn AJAX request to the Bricks query page route, carrying the loop ID and the page.
- Loop rebuilt for that pageThe same query settings run again, with the next page number, and only the items render.
- HTML returnedThe rendered loop items come back, not the whole page.
- Nodes appendedThe script adds the items to the loop and fires its events.
- End of the listAfter the last page the Load more button is hidden with a CSS class.
Numbered pagination first: the baseline you should always have
Start every paginated loop with numbered pagination, even if you plan to add Load more later. It is the baseline that works with no script, and it gives every page of results a real address. In Bricks the Pagination element is in the WordPress group of the elements panel. Add it below the loop, then choose the loop it controls in its Related Query control (the schema calls the control Query). Because the control lists the loops on the page by element name, name your loop elements clearly, for example “Post grid”, before you add the Pagination element.
The element builds its links with the WordPress paginate_links function; the Bricks documentation exposes a filter for its arguments, and the element’s own settings include End Size (how many page numbers are shown at the start and end) and Mid Size (how many show on each side of the current page), plus icons for previous and next, spacing, background, border and typography for the buttons and for the current page. Those controls style the output without CSS. Add CSS only for what the controls do not cover, such as a visible keyboard focus ring and comfortable tap targets. The element’s markup uses a pagination wrapper with a list of links, and the schema documents the selectors the controls write to, which the CSS below reuses.
.bricks-pagination ul {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 0;
padding: 0;
list-style: none;
}
.bricks-pagination .page-numbers {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 2.75rem;
min-height: 2.75rem;
padding: 0 0.75rem;
border: 1px solid #c9d1de;
border-radius: 0.5rem;
color: #1c2430;
text-decoration: none;
}
.bricks-pagination a.page-numbers:hover {
background: #eef2f9;
}
.bricks-pagination a.page-numbers:focus-visible {
outline: 3px solid #1a4fd1;
outline-offset: 2px;
}
.bricks-pagination .page-numbers.current {
border-color: #1a4fd1;
background: #1a4fd1;
color: #ffffff;
font-weight: 700;
}
.bricks-pagination .page-numbers.dots {
border-color: transparent;
}The rules in order. The list becomes a wrapping row with a gap, so many page numbers never overflow a phone. Each link or number gets a minimum size of 2.75rem, which keeps tap targets comfortable. The hover state is a quiet tint, the focus-visible rule gives keyboard users a strong ring without showing it on mouse clicks, the current page is filled so it is obvious without relying on colour alone (it also has a heavier weight), and the dots that mark skipped ranges lose their border so they do not look clickable.
If you want text labels for the previous and next links instead of bare arrows, the documented filter lets you change them. Labels such as “Previous page” and “Next page” are clearer to screen reader users than an arrow icon alone. If the element’s icon controls already give you what you want, skip this.
add_filter( 'bricks/paginate_links_args', function ( $args ) {
$args['prev_text'] = 'Previous page';
$args['next_text'] = 'Next page';
$args['mid_size'] = 1;
return $args;
} );Put the snippet in a child theme’s functions file or a small site plugin. It changes the labels and shows one page number on each side of the current one. On an archive or search template there is one more rule from the Bricks documentation: mark exactly one loop as the main query with the Is main query control, and point the Pagination element at that loop. Otherwise the pagination can return a 404 when a visitor goes to page two. The figure shows a plain HTML and CSS render of this pagination styling, not the Bricks editor.

Loop settings that make any pagination correct
Pagination breaks quietly. The buttons work, the pages load, and yet visitors see the same post twice or never see another one. Most of those failures come from the loop’s query settings, not from the pagination element or the script, so set them before you style anything. The controls below are all in the Query control of the loop element, and the names come from the Bricks documentation.
Posts Per Page. By default it follows the Reading setting “Blog pages show at most”. Set it on purpose. Choose a number that fills complete rows at every column count you use: twelve divides evenly into two, three, four and six columns, so the last row of a batch is never ragged. Bigger batches mean fewer requests but a heavier render each time, and fewer clicks before the footer. For Terms and Users loops the equivalent control is Number.
A stable sort. When several posts share the same value for the sort key, such as the same menu order, the same price or the same date, the database is free to return them in any order, and it can choose a different order on each request. A post can then appear at the end of page one and again at the start of page two, or be skipped. The Bricks documentation gives the rule: when you order by more than one criterion, include the post ID as the secondary one, and the Order By and Order controls accept multiple values in current versions so no PHP is needed. The most common trap is ordering by menu order while most posts still have the default value; a Bricks team member explained on the forum that equal values make the database return ties in an unreliable sequence, and a second sort key fixes it.
Random order. A random sort reshuffles on every request, which guarantees duplicates across batches. The Posts query has a Random seed TTL control, a duration in minutes for which the random seed is kept so the sequence stays the same across pages and infinite scroll loads. Setting it to 0 turns the feature off. Use a short value rather than none for any random loop that paginates.
No Found Rows. The documentation describes this option as an improvement for loops that do not need pagination, result counts or max page counts. A paginated loop needs exactly those, because Bricks has to know how many pages exist to know when to stop. Leave No Found Rows off on any loop you paginate, and turn it on only for fixed lists such as “latest three”. This is the opposite of the advice for the small inner lists in a nested loop, and the reason is the same: choose the option from what the loop needs.
Ignore Sticky Posts, offset and merging. On a blog listing, sticky posts are moved to the front, and WordPress does that only on the first page, which can make page sizes look uneven; Ignore Sticky Posts avoids it. WP_Query treats an offset as a replacement for paging, so avoid an offset on a loop you paginate unless you have tested exactly how your version combines them. On archive and search templates, mark the one loop that lists the archive as the main query, use Disable Query Merge on every other loop, and aim the Pagination element at the main one, as the documentation’s troubleshooting notes for archive 404s say.
When a pagination problem appears, return to this list before touching the interface. A loop with a stable sort, found rows on, a sensible batch size and the right main query setting paginates correctly with every pattern in this guide.
The figure makes the batch size point concrete. It is a plain HTML and CSS render of numbered tiles in grids with two, three, four and six columns, not a screenshot of the Bricks editor. Twelve tiles end on a complete row in all four grids. Ten tiles complete the two-column grid and leave a ragged last row in the other three, and that ragged row is what a visitor sees at the end of every batch, because each Load more click adds the same count again.

The native Load more button
Bricks gives you two routes to a Load more button. The quick one is the Posts element, whose Pagination setting offers none, numbers, load more and infinite scroll, plus text controls for the button label, the loading text and a message for when there are no more posts. The flexible one works with any loop. You add a Button element, open its Interactions, and add an interaction with the Click trigger and the action Load more (Query loop). That action does not use the usual Target control. It has its own field for choosing the loop to load more into, so select your named loop there. The Bricks documentation notes this is typically done on a Button, but any element can carry the interaction.
Three details save time. First, hiding. Bricks shows and hides the Load more button itself, adding a CSS class when the last page has been fetched. A Bricks team member explained on the forum that a Show element interaction on the same button overrides that class, so the button stays visible after the last page. If you want a loading style, use the Query AJAX loader triggers (Start and End) to add and remove a class, as the Interactions documentation does with an opacity example, instead of showing and hiding the button. Second, counts. The Query Results Summary element prints text such as “Results: 1 – 12 of 48 posts” from a format with start, end and total placeholders, and the documentation says it updates with AJAX pagination, Load more, infinite scroll and query filters, which makes it the simplest way to give visitors, and screen reader users, a running count. Third, several loops. Forum reports describe problems when more than one Load more button and loop share a page, so if you need that layout, test it thoroughly on the front end, and consider the custom script later in this guide, which handles one list per page and is simple to extend.
The weak point of native Load more is what it does for crawlers and for people without scripts. The button triggers a request, and nothing in the page links to page two. If the list matters for search, keep a numbered Pagination element on the same loop as a fallback. Be aware that native Load more does not update that numbered element as batches arrive, so the links keep pointing at the old state. That is acceptable as a safety net, but if you want the links and the button to stay in step, the custom approach in the second half of this guide is built for exactly that.
Finally, interactions run on the front end only. The Bricks documentation says to test them in preview or on the published page, not in the builder canvas, so do not judge Load more by what the canvas shows.
Native infinite scroll and the events it fires
Infinite scroll is a setting on the query loop itself. When it is on, Bricks watches the end of the loop and requests the next page without a click. The loop’s query settings include controls for it, among them an offset. A Bricks team member described the offset on the support forum as a preloading distance: with an offset of 300, the next batch starts loading when the visitor is about 300 pixels from the trigger, so a larger value loads earlier and feels smoother on slow connections, while a smaller one waits longer and avoids unnecessary requests. The exact labels can change between versions, so look in the loop’s Query control for the infinite scroll group rather than relying on a name from an article.
Everything from the earlier section applies, and a few things matter more. Duplicates are the classic infinite scroll bug because visitors stay on the page longer, so a non-deterministic sort has more time to reshuffle; use the stable sort and the Random seed TTL control. Filters need care: forum threads describe infinite scroll stopping after a filter is applied, which is a reminder to test the combination you ship rather than each feature alone. And remember that the footer problem is real. If the footer holds navigation people need, an endless list pushes it away, which the accessibility section addresses.
For your own code, Bricks documents custom JavaScript events for its AJAX features, and the infinite scroll sequence is useful to know. The timeline shows the order the documentation gives. The start event fires before the request, the nodes added event fires once the new items are in the DOM, the end event fires after the call completes, and a final event fires after an infinite scroll page load completes. Each carries the loop’s query ID in its detail, so your listener can ignore loops that are not yours. The documentation also notes that the standalone AJAX pagination event is not emitted when the Pagination element targets a loop with Query Filters; in that case listen to the filter events instead.
document.addEventListener('bricks/ajax/nodes_added', function (event) {
var queryId = event.detail && event.detail.queryId;
if (queryId !== 'abc123') { return; } // the six-character ID of your loop element
var count = document.querySelectorAll('.post-card').length;
var status = document.querySelector('.post-count-status');
if (status) {
status.textContent = count + ' posts shown';
}
});The listener waits for the nodes added event, checks that it belongs to your loop, counts the cards now in the page and writes the number into a status element. Give that element an aria-live attribute set to polite, and screen reader users hear the new total each time a batch arrives. Replace the ID with your loop’s ID and the class names with your own. The same event is the right place to initialise any script that needs the new nodes to exist, such as a third-party lightbox.
Events fired by a native infinite scroll batch
SEO: search engines follow links, not clicks and scrolling
A search engine discovers content by fetching URLs and following the links it finds in the HTML. It can run scripts, but it does not behave like a visitor: it does not click a Load more button or scroll to trigger a loader the way a person does. The published guidance from search engines about infinite scroll has said the same thing for years: if content appears only after a user action, also make it available on paginated pages with their own URLs that can be linked to. That single idea explains how each pattern fares.
Numbered pagination is the safe case. Every page is a normal URL with a normal title, and the links between them are in the HTML from the first response. Nothing depends on a script. A native Load more button or native infinite scroll is the risky case. Items beyond the first batch do not exist in the page until a request is made, and nothing in the HTML links to them. If those items are reachable only that way, they may never be discovered, or they may be discovered through some other path such as a category page or a sitemap while the list itself contributes nothing. So the practical rule is to keep real links to the paginated URLs in the page, whichever interface sits on top.
There are three ways to do that with Bricks. Keep a numbered Pagination element on the same loop alongside a native Load more button, accepting that the numbered links do not update as batches load. Build the list as numbered pagination and enhance it with the custom script later in this guide, which reads the real next-page link and keeps the pager in step with what has loaded. Or, for lists that do not need to rank, accept the limitation but make sure the items are reachable from category pages, related post sections and your sitemap. Whichever you choose, check it the way a crawler would: view the page source (not the inspected elements, which show the page after scripts run) and confirm the pagination links are there, and use the URL inspection tool in your search engine’s console to see what the rendered page contains.
Three smaller points. Each paginated page normally canonicalises to itself, not to page one, so that the items on it stay discoverable; most SEO plugins do this for archives, but check yours on a paginated URL. Google has said it no longer uses the rel previous and next link hints as an indexing signal, so the visible links are what matter. And watch click depth: an item that sits on page thirty is thirty links from the start. If the archive is long, raise the batch size, link from hub pages and related posts, and see the WPresident guide on internal linking strategy for how to spread links to deep content.
The decision below sums up which pattern to choose for which kind of list when search matters.
Choosing a pattern when search matters
Accessibility: focus, announcements and the footer problem
Pagination that works with a mouse can still fail a keyboard or screen reader user in four specific ways: nothing tells them that new content arrived, their focus is left in the wrong place, the control is not a real control, or they can never reach the end of the page. Each has a small fix.
Announce the result. When new items are added, a sighted visitor sees the list grow. A screen reader user hears nothing unless you tell them. Keep a status element in the page with an aria-live attribute set to polite, or the role of status, and write a short message into it after each batch: “12 more posts loaded. 24 posts shown.” The live region has to exist in the page before you change its text, so create it at load, not at the moment you need it. Bricks’ own Query Results Summary element serves the same purpose for the native features, and the event listener shown earlier can write the count for them.
Move focus deliberately. After a click on Load more, the button has usually moved down because items were added above it, and keyboard focus is still on the button. The user would have to navigate back up to find what loaded. A good pattern is to move focus to the first new item, which needs a tabindex of minus one so a non-interactive element can receive focus, and to remove it again when focus leaves. Do this only for a deliberate click, never for automatic infinite scroll loads, which would steal focus while the person is reading. The custom script later in this guide does exactly that.
Use real controls. A Load more control that performs an action is a button, and one that goes to another URL is a link. Do not disable the button with the disabled attribute while a request runs, because some browsers then drop focus to the top of the page; use aria-disabled and aria-busy instead and ignore clicks in your code. The pagination links should sit in a navigation landmark with an accessible label. If the markup you get does not provide one, wrap the Pagination element in a Div whose HTML tag is set to nav and give it a label through the element’s custom attributes.
Keep the footer reachable. The classic infinite scroll trap is that the content below the list is pushed further away every time the list grows, so keyboard users tab through an ever-longer list and never reach the footer. The remedy is structural. Cap the automatic loading at a few batches and then show a Load more button, so the visitor chooses to continue, or offer a skip link to the content after the list. Also remember the Back button: when a visitor opens an item and returns, a list that was extended by script is usually back at its first batch. That is another reason to keep real page URLs and a sensible batch size.
Two last details. Error messages belong in the same live region as success messages, because a failed load that is silent looks like a broken page. And if you animate new items in, respect the reduced motion preference so that people who ask for less movement do not get it.
The figure shows the visible side of several of these points as a plain HTML and CSS render, not a screenshot of the Bricks editor. The top half draws the button in its default, hover, keyboard focus and busy states; the hover and focus states are forced with helper classes that carry the same declarations as the matching rules in the stylesheet later in this guide, and the busy state is driven by the real aria-busy and aria-disabled attributes. The bottom half shows the focus ring on the first new card after a click, with the live region message below it.

A custom Load more that enhances real links: the contract and the design
The custom approach in this guide is progressive enhancement. The page always contains the list and a numbered pager with real links, exactly as in the baseline section. A script then adds a Load more button, and when the visitor clicks it, the script fetches the same URL a crawler would follow, copies the new items out of the response, appends them, and updates the pager so its Next link points at the following page. If the script never runs, or fails, the numbered links still work and every page has an address. That safety property is what the native features do not give you on their own, and it is the reason to write this script.
It needs a small contract with your Bricks structure, built with ordinary elements and classes. The skeleton below shows what the front-end HTML should look like. In the builder, the wrapper and the list are Div elements without a loop. The loop element is the item, and it carries the class lm-item through the CSS classes control, so each post becomes one lm-item inside the lm-list. The Pagination element sits inside a Div with the class lm-pager. Turn off Enable AJAX on that Pagination element, and do not enable Bricks’ own Load more or infinite scroll on the same loop, so the two systems do not compete for the same clicks.
<div class="lm">
<div class="lm-list">
<article class="lm-item"><a href="/first-post/">First post</a></article>
<article class="lm-item"><a href="/second-post/">Second post</a></article>
</div>
<div class="lm-pager">
<!-- the Bricks Pagination element renders its links here -->
</div>
<p class="lm-status" role="status"></p>
</div>Add the script below to the page’s custom JavaScript (Page Settings, Custom Code), or enqueue it from a child theme if you want it on several templates. Check whether the field you use expects script tags; the Bricks documentation says the global script fields do. There are limits to be clear about. The script copies HTML, so it suits cards made of text, links and images. Bricks attaches interactions and element scripts when the page loads, so an item that relies on one, such as a popup trigger or a slider inside each card, may not be wired up when you append it yourself; for those lists use the native features, which announce new nodes through the nodes added event. Images are fine: Bricks applies native lazy loading to images by default, so images in appended items load as they approach the viewport. Finally, the script fetches a whole page and keeps only the items, which sends more bytes than a fragment request would. In exchange you get a request that is an ordinary cacheable page URL.
The flow below is what the script does on each click, in order.
What the custom script does on each click
- Read the next linkFind the Next link in the pager, or the link after the current page. No link means the last page.
- GuardIf a request is already running, ignore the click. Otherwise mark the button busy.
- Fetch the pageRequest the same URL a crawler would follow, from the same origin.
- Parse and selectParse the response and pick the items inside the list; fail clearly if there are none.
- Remove duplicatesSkip any item whose first link is already on the page, then append the rest in one step.
- Swap the pagerReplace the pager with the fetched one so Next now points at the following page.
- Announce and finishWrite the count to the live region, move focus to the first new item, remove the button on the last page.
The script, part by part
Here is the complete script. It is plain JavaScript with no dependencies and no template literals, so it can be pasted as it is. Change the two constants at the top if you want a different label or automatic loading, covered in the infinite scroll section.
(function () {
'use strict';
var AUTO_PAGES = 0; // 0 = button only; 2 = auto-load two batches, then show the button
var LABEL = 'Load more posts';
var root = document.querySelector('.lm');
if (!root || !window.fetch || !window.DOMParser) { return; }
var list = root.querySelector('.lm-list');
var pager = root.querySelector('.lm-pager');
if (!list || !pager) { return; }
function nextUrl() {
var next = pager.querySelector('a.next');
if (!next) {
var current = pager.querySelector('.current');
var currentItem = current ? current.closest('li') : null;
var nextItem = currentItem ? currentItem.nextElementSibling : null;
next = nextItem ? nextItem.querySelector('a') : null;
}
return next ? next.href : '';
}
if (!nextUrl()) { return; }
var status = root.querySelector('.lm-status');
if (!status) {
status = document.createElement('p');
status.className = 'lm-status';
status.setAttribute('role', 'status');
root.appendChild(status);
}
var button = document.createElement('button');
button.type = 'button';
button.className = 'lm-button';
button.textContent = LABEL;
list.insertAdjacentElement('afterend', button);
var sentinel = null;
var observer = null;
var loading = false;
var autoLoaded = 0;
var seen = new Set();
function keyOf(item) {
var link = item.querySelector('a');
return link ? link.getAttribute('href') : item.textContent.trim().slice(0, 120);
}
list.querySelectorAll('.lm-item').forEach(function (item) { seen.add(keyOf(item)); });
function setBusy(isBusy) {
loading = isBusy;
button.setAttribute('aria-disabled', isBusy ? 'true' : 'false');
button.setAttribute('aria-busy', isBusy ? 'true' : 'false');
button.textContent = isBusy ? 'Loading' : LABEL;
}
function finish(message) {
if (observer) { observer.disconnect(); }
if (sentinel) { sentinel.remove(); }
button.remove();
status.textContent = message;
}
function loadNext(fromAuto) {
var url = nextUrl();
if (!url) { finish('All posts are loaded.'); return; }
if (loading) { return; }
setBusy(true);
fetch(url, { credentials: 'same-origin' })
.then(function (response) {
if (!response.ok) { throw new Error('HTTP ' + response.status); }
return response.text();
})
.then(function (html) {
var doc = new DOMParser().parseFromString(html, 'text/html');
var incoming = doc.querySelectorAll('.lm-list .lm-item');
if (!incoming.length) { throw new Error('No items found on the next page'); }
var fresh = [];
incoming.forEach(function (item) {
var key = keyOf(item);
if (!seen.has(key)) {
seen.add(key);
fresh.push(document.importNode(item, true));
}
});
var fragment = document.createDocumentFragment();
fresh.forEach(function (node) { fragment.appendChild(node); });
list.appendChild(fragment);
var newPager = doc.querySelector('.lm-pager');
pager.innerHTML = newPager ? newPager.innerHTML : '';
var total = list.querySelectorAll('.lm-item').length;
status.textContent = fresh.length + ' more posts loaded. ' + total + ' posts shown.';
if (fresh.length && !fromAuto) {
var first = fresh[0];
first.setAttribute('tabindex', '-1');
first.addEventListener('blur', function () { first.removeAttribute('tabindex'); }, { once: true });
first.focus();
}
setBusy(false);
if (!nextUrl()) {
finish(total + ' posts shown. That is all of them.');
} else if (observer) {
observer.unobserve(sentinel);
observer.observe(sentinel);
}
})
.catch(function () {
setBusy(false);
if (observer) { observer.disconnect(); }
status.textContent = 'Could not load more posts. Use the page links below, or try again.';
});
}
button.addEventListener('click', function (event) {
event.preventDefault();
loadNext(false);
});
if (AUTO_PAGES > 0 && 'IntersectionObserver' in window) {
sentinel = document.createElement('div');
sentinel.className = 'lm-sentinel';
sentinel.setAttribute('aria-hidden', 'true');
list.insertAdjacentElement('afterend', sentinel);
observer = new IntersectionObserver(function (entries) {
if (!entries[0].isIntersecting || loading) { return; }
if (autoLoaded >= AUTO_PAGES) { observer.disconnect(); return; }
autoLoaded += 1;
loadNext(true);
}, { rootMargin: '0px 0px 400px 0px' });
observer.observe(sentinel);
}
})();What the parts do. The wrapper function keeps every variable private so nothing leaks into the global scope. The first guard stops quietly when the browser lacks fetch or the DOM parser, or when the expected elements are missing, which leaves the page exactly as the server sent it. The function that finds the next URL looks for a link with the class next inside the pager, which is what the WordPress pagination function produces, and falls back to the link that follows the current page in the list. The script returns early when there is no next link, so a one-page list never gets a button.
The status element is created if the page does not have one, with the role of status so it works as a live region. The button is created by the script, not placed in the HTML, so visitors without JavaScript never see a control that does nothing. The set named seen holds a key for every item already on the page, built from the first link’s address, or from the text if there is no link. That is the duplicate guard: if a new post was published between two clicks and shifted the pages, an item that already appeared is skipped instead of repeated.
The busy function sets aria-busy and aria-disabled on the button and changes its text, and it records the state in the loading variable so extra clicks are ignored. It uses aria-disabled rather than the disabled attribute so keyboard focus is not dropped. The load function does the work. It fetches the URL with same-origin credentials, throws on a non-success status so the catch handler runs, parses the response into a separate document, and selects the items inside its list. If there are none, it throws, because an empty result usually means the markup changed, not that the list ended.
New items are imported into the current document and appended in a single fragment, so the browser lays them out once. The pager is replaced with the fetched one, which is what keeps the numbered links and the button in step: after page two arrives, the pager shows page two as current and links to page three. The status text reports how many items arrived and how many are shown. Focus moves to the first new item only for a click, with a temporary tabindex that is removed when focus leaves. After the request, the script checks the new pager: no next link means the button is removed and the final message is written. Any failure lands in the catch handler, which clears the busy state and writes a plain message that points to the page links, which are still there.
Replace the class names if your structure differs, but keep the roles: one wrapper, one list that contains only items, items with a link inside, and a pager. If the Pagination element renders its markup differently from the assumption in the next-link function, inspect the front-end HTML in the browser and adjust that one function.
The matching CSS and the rendered result
The script adds structure, not styling, so the look is entirely CSS. The rules below turn the list into a responsive grid, give the cards a clear shape, reserve space for images, and style the button, its busy state and the status line. Put them in the page’s custom CSS or in global classes, next to the classes from the contract.
.lm-list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
gap: 1.25rem;
}
.lm-item {
overflow: hidden;
border: 1px solid #d5dbe5;
border-radius: 0.75rem;
background: #ffffff;
}
.lm-item img {
display: block;
width: 100%;
aspect-ratio: 16 / 9;
object-fit: cover;
}
.lm-item:focus-visible {
outline: 3px solid #1a4fd1;
outline-offset: 2px;
}
.lm-button {
display: block;
margin: 1.75rem auto 0;
padding: 0.8rem 1.75rem;
border: 0;
border-radius: 999px;
background: #1a4fd1;
color: #ffffff;
font: inherit;
font-weight: 600;
cursor: pointer;
}
.lm-button:hover {
background: #153fa8;
}
.lm-button:focus-visible {
outline: 3px solid #1a4fd1;
outline-offset: 3px;
}
.lm-button[aria-busy="true"] {
opacity: 0.65;
cursor: progress;
}
.lm-status {
min-height: 1.5em;
margin: 0.75rem 0 0;
text-align: center;
font-size: 0.9rem;
}
.lm-sentinel {
height: 1px;
}Why each part. The grid uses auto-fill with a minimum column width inside min(), so it flows from many columns to one without a media query and never overflows a narrow screen. The aspect-ratio rule on images reserves the image’s space before it loads, which stops appended cards from pushing content around. The focus-visible rule on the item shows a ring on the card that the script focuses after a click, but only when the visitor is using a keyboard, so mouse users do not see it. The button is a solid, high-contrast pill with a visible focus ring, and the aria-busy rule dims it while a request runs. The status line reserves a line of height so the page does not jump when the first message appears, and the sentinel is a one-pixel marker used only by the infinite scroll mode.
The render below shows the result as plain HTML and CSS drawn in a browser, with placeholder blocks where images would be. It is not a screenshot of the Bricks editor, and the cards are an illustration of the technique.

Infinite scroll mode with a cap, built on IntersectionObserver
The same script can load batches automatically. Change the constant at the top to a number of batches, for example two, and the script adds a sentinel: an empty, one-pixel, aria-hidden element placed right after the list. An IntersectionObserver watches the sentinel. When it comes within 400 pixels of the bottom of the viewport, set by the root margin, the script loads the next batch, up to the cap. After the cap, the observer is disconnected and the visitor is back to the Load more button, which has been sitting below the sentinel all along. That is the hybrid that keeps the footer reachable: a few automatic batches for the people who scroll, then a deliberate choice.
Several details in the code are worth understanding before you change them. After every successful batch the script unobserves and observes the sentinel again. An IntersectionObserver reports a change in visibility, so if the new items are few and the sentinel is still on screen, there would be no new notification and the loading would stall. Observing again forces an initial report with the current state. The script ignores a visibility report while a request is running, which prevents overlapping requests when a visitor scrolls quickly. Automatic loads do not move focus and are announced through the same status line as clicks. If your audience uses screen readers heavily, consider announcing less often, for example only on the last batch, because a message for every automatic load can be noisy.
The script deliberately does not change the browser’s address as batches load. It is tempting to update the URL to the latest page with the history API, but it creates a trap: a reload then shows only that page, with none of the earlier items, and a shared link opens in the middle of a list. The address of the list should stay the address of its first page, with the real page URLs available through the pager links. If you do want the address to track the position, replace the current history entry rather than adding one for every batch, so the Back button is not flooded with entries, and understand that a reload still loses the earlier items.
Choose the cap from the content, not from enthusiasm. For a feed of short cards, two or three automatic batches is generous. For anything people compare, skip automatic loading entirely and keep the button. Remember too that the document grows with each batch. Hundreds of cards with images make the page heavier to lay out and to scroll, which is the performance cost of the pattern and the main reason for a cap. If the browser lacks IntersectionObserver, the script skips the automatic part and the button still works, so older browsers get the safe version.
The figure shows the end state of that hybrid as a plain HTML and CSS render, not a screenshot of the Bricks editor. After the automatic batches stop, the last row of cards is followed by the button and the status line, and the footer navigation is still one scroll away. With no cap, every new batch would push that footer further away.

Caching, performance and Core Web Vitals
Each batch is a request, so think about which layer can answer it. With the custom script, the request is a plain GET of a normal page URL, so a browser cache, a CDN, a page cache plugin or a server cache can serve it without running PHP, exactly as they serve a visitor who opens page two. The price is that the response is the whole page, header, footer and all, of which the script keeps only the items. Native Bricks loading asks the Bricks AJAX route for just the loop items. Reports on the Bricks forum show that request as a POST to the route in the browser’s network panel, and page caches generally do not store POST responses, so each native batch runs PHP and the loop query. Check your own network panel to see which it is on your site. Whichever you use, purge the list pages when posts or terms change, and a persistent object cache helps repeated lookups but does not replace a sensible batch size.
Core Web Vitals are affected in small, predictable ways. The first page of results decides the largest contentful paint, and later batches do not change it. Layout shift is the risk: reserve image space with an aspect ratio, add items below the viewport rather than above it, and keep the button and status line in a stable place. Interaction latency is rarely a problem for a click that appends a fragment of cards, but it can become one if each item carries heavy scripts. The long-term cost is document size, because an infinite list that never stops growing makes every later layout and scroll slower. The WPresident guide on Core Web Vitals covers how to measure these properly with field data.
Measure instead of guessing. In the browser network panel, record the size and time of one batch request on a throttled connection and compare it with the first page. In the performance panel, watch how long the main thread is busy while a batch is appended. Those two readings, bytes transferred and main thread time, tell you whether to shrink the batch, cache the list pages or trim the card markup. Repeat the check with the page cache on and off, because the answer often changes.
Who can answer a next-page request
What goes wrong: symptoms, causes and fixes
Most pagination failures are one of a short list. Match the symptom, check the cause, and change one thing at a time.
- Native Load more or infinite scroll does nothing. Open the browser’s network panel and click again. A failed request to the Bricks query page route, often a 403, points to a firewall, security plugin or REST restriction. No request at all points to a script error from another plugin, an interaction that targets the wrong loop, or an optimisation plugin that stripped the Bricks loop comments.
- The custom script does nothing. Check the console for errors, confirm the class names match your elements, and make sure the script runs after the elements exist, for example from a footer location. Then inspect the pager’s real markup. If the Next link is not found, adjust the one function that locates it.
- Duplicates or skipped items. The sort is not stable, a random order reshuffles between requests, or a post was published between two batches. Add the post ID as a secondary sort and set the Random seed TTL; the custom script also skips items it has already shown.
- A 404 on page two of an archive. Exactly one loop must be the main query, and the Pagination element must target it. Other loops on the template need Disable Query Merge.
- The native Load more button stays visible on the last page. A Show element interaction on the same button is overriding the class Bricks uses to hide it. Remove that interaction and use the Query AJAX loader triggers to add and remove a class for loading styles.
- New items have no behaviour. With the custom script, Bricks did not initialise scripts for nodes you appended. Use the native features for cards that need Bricks interactions, or keep the cards simple. With native loading, run your own initialisation from the nodes added event.
- Batches arrive in the wrong language. On multilingual sites the AJAX request must carry the language. Bricks provides an action at the start of rendering a query page, whose documentation example is exactly a language switch; ask your multilingual plugin’s documentation which value to pass.
- The result count is wrong. The Bricks documentation notes that a plugin that disables Bricks query history through the force run filter can make the Query Results Summary show incorrect information.
- It works for you and not for visitors. Compare logged-in and logged-out behaviour, then look at cache and firewall rules that treat the two differently.
- The layout jumps as items arrive. Reserve image space with an aspect ratio and keep the button and status line in a stable place.
When you cannot tell which layer is at fault, test with every optional layer removed: pagination links only, no script, no cache. Then add one layer at a time. A numbered pager that works on its own is the reference point for everything else.
Checklist
- Decide the pattern from the visitor’s goal: a destination list, a browse surface or a casual feed.
- Build numbered pagination first and confirm that every page has its own working URL.
- Name the loop element clearly and point the Pagination element at it through its Related Query control.
- Set Posts Per Page to a number that fills complete rows at every column count you use.
- Use a stable sort with the post ID as a secondary criterion, and set the Random seed TTL on random loops that paginate.
- Leave No Found Rows off on any loop that paginates, and avoid an offset unless you have tested it.
- On archive and search templates, mark exactly one loop as the main query, use Disable Query Merge on the others and aim the Pagination element at the main loop.
- Keep the Bricks loop HTML comments by excluding them from any minifier or comment remover.
- Keep real links to the paginated URLs in the HTML and check the page source, not only the inspected elements.
- Check that paginated pages canonicalise to themselves and have distinct titles in your SEO plugin.
- Provide a live region that announces how many items loaded, and test it with a screen reader.
- Move focus to the first new item after a click, never after automatic loads.
- Use aria-disabled and aria-busy on the button instead of the disabled attribute.
- Cap infinite scroll at a few batches and finish with a button so the footer stays reachable.
- Reserve image space with an aspect ratio so appended items do not shift the layout.
- Do not combine the custom script with Bricks’ own Load more or infinite scroll on the same loop, and turn off Enable AJAX on the Pagination element it enhances.
- Test the failure path by blocking the request or going offline, and confirm the message appears and the page links still work.
- Purge list pages when content changes, and test with the page cache on, off and after a purge.
Read this next
About this guide. This is general guidance written by WPresident Editorial from documentation and widely used practice. WPresident has not benchmarked the products or methods described. Interfaces and plan limits change, so check the vendor’s current documentation before you act. Not legal, tax or financial advice. See our editorial policy.
Frequently asked questions
Which is better for SEO: numbered pagination, Load more or infinite scroll?
Numbered pagination, because every page is a plain URL with plain links and nothing depends on a script. Load more and infinite scroll can be search-friendly only if the real paginated links stay in the HTML and the interface is built on top of them. A native button or scroll loader on its own leaves items beyond the first batch without links, so make sure they are reachable another way, such as category pages and a sitemap.
Can search engines see items loaded with a Load more button?
Generally not through the button. Search engines can run scripts, but they do not click buttons or scroll the way a visitor does. Items are discoverable if there are real links to paginated URLs in the page, or if the items are linked from elsewhere. Check by viewing the page source for the pagination links and by using the URL inspection tool in your search engine's console to see the rendered page.
Does Bricks infinite scroll work with a page cache?
The first page of the list is cached like any other page. The extra batches are requested through a Bricks AJAX route, which reports on the Bricks forum show as a POST request, and page caches generally do not store POST responses. So batches usually reach PHP. It works as long as no cache or firewall rule blocks that route. If batches fail for visitors but not for you, compare logged-in and logged-out requests in the network panel.
Why do I see duplicate posts after loading more?
Usually the sort is not stable. Posts that share the same sort value, such as menu order or date, can come back in a different order on each request, so one appears on two pages. Add the post ID as a secondary sort, and set the Random seed TTL for random loops. A post published between two batches can also shift the pages, which the custom script handles by skipping items it already shows.
Why does the Load more button stay visible after the last page?
Bricks hides the native button with a CSS class once the last page is fetched. A Bricks team member explained on the forum that a Show element interaction on the same button overrides that class. Remove the interaction that shows the button, and use the Query AJAX loader start and end triggers only to add and remove a class for a loading style. Also check that No Found Rows is off, since Bricks needs the page count.
Can I use Load more together with Bricks Query Filters?
The documentation says pagination takes part in the filter system when Enable AJAX is on and it targets the same loop, so selected filters and the page stay together. Forum threads report problems with some combinations of filters and infinite scroll or Load more, so test the exact setup you ship. The custom script in this guide reads a pager from the page and is not meant to be combined with filters that update the list through AJAX.
How many items should each batch load?
Pick a number that fills complete rows at every column count, for example twelve for two, three, four and six columns. Bigger batches mean fewer requests and fewer clicks but a heavier render each time. For image-heavy cards, smaller batches keep each response light. There is no universal best value, so choose from your card weight and test on a slow connection.
Can I have more than one Load more loop on a page?
Native Load more supports it in principle, but forum reports describe buttons and loops getting mixed up when several share a page, so test the layout carefully. The custom script in this guide targets one wrapper, found by its first match. To support several, change the selector to find every wrapper and run the script's logic once for each, keeping the state variables inside that function.
How do I keep the footer reachable with infinite scroll?
Cap the automatic loading at a few batches and then show a Load more button, so the visitor chooses to continue. The hybrid keeps the benefits of automatic loading for people who scroll and gives keyboard users a way to reach the footer. You can also add a skip link to the content after the list. Avoid an endless list when the footer holds navigation people need.
Should the URL change as more posts load?
Usually not. If the address tracks the latest batch, a reload shows only that page without the earlier items, and a shared link opens mid-list. Keep the list's address as its first page and expose the real page URLs through the pager links. If you do update the address, replace the current history entry instead of adding one for every batch.
Does Load more hurt Core Web Vitals?
Not by itself. The first page of results decides the largest contentful paint, and later batches do not change it. The risks are layout shift from appended items without reserved image space and a growing page that becomes slower to lay out and scroll. Reserve space with an aspect ratio, add items below the viewport, cap automatic loading and measure on a throttled connection.
Do I need the custom script, or are the native features enough?
If your cards use Bricks interactions or elements that need their scripts, and search discovery of deep items does not matter, the native features are simpler and keep those behaviours working. Choose the custom approach when you want real next-page links to stay in the page, cacheable GET requests and full control of focus and announcements, and your cards are plain HTML such as text, links and images.



