13th Aug '24
/
6 comments

Load more for Query loops in Bricks

Did you know that Bricks has AJAX loading on-click for query loop posts out of the box?

This article shows how AJAX Load more functionality can be configured in Bricks.

Step 1

Edit your Page/template with Bricks.

Copy and paste the fully built Section of the above demo using this JSON.

Note: A few ACSS utility classes and variables are used.

A click Interaction has been set on the Button like this:

Select your query loop-enabled element’s label or ID in the Query control.

This is how the loading animation is made to appear inside the AJAX Loader div (below the button):

Step 2 (only if using ACSS)

Add this global CSS:

a[class*="btn--"].brx-load-more-hidden {
    display: none;
}

If you have Advanced Themer, you could do it right from within the builder.

That’s it. Save and check on the front end.

Reference

https://community.automaticcss.com/c/bricks/acss-overriding-brx-load-more-hidden-s-css

Get access to all 612 Bricks code tutorials with BricksLabs Pro

6 comments

  • Benjamin Ogg

    Dear Sridhar, This function is truly awesome. I have a UX improvement suggestion. Use Case:

    1. The user clicks the «Load more» button 3 times
    2. They click on a post and get to the page (in same window/tab)
    3. They click the browser back button

    Desired scenario: Currently, they have to start over and «retrieve» all posts again. Ideally, they could continue where they left off. Is this possible? Cheers, Benjamin

    • Benjamin Ogg

      Dear Sridhar, I just saw, that here in BricksLabs you have implemented this. When I scroll down on the archive page more posts are loaded. Navigating to a post in same window and then return to the archive by browser back button brings me back where I left. Awesome! That's exactly what I would love to have for this solution here too. Is that possible? Cheers, Benjamin

      • Tom Homer

        Hi Sridhar,

        I am wondering the same thing. To make Load More accessible it needs the following:

        Update Live Region: After loading new content, it's important to update a live region (using aria-live="polite") to inform users of the updated content, especially for screen reader users.

        Manual Focus: When new content loads, focus should be moved to the first interactive element in the new set of items, making it easier for users to navigate.

        Which Bricks native Load More doesn't do. WP GridBuilder does add the aria-live="polite" but doesn't do the manual focus.

  • eins walter

    Acss btn-- thing is great!!

    Does load-more work only with Bricks builder loop? Or Jetengine query in Bricks Builder too?

    • A

      Yes.

      I do not know if AJAX Loader works though. I've just sent a support email to Bricks about it.

      But having a button to load more posts and adding an interaction like I wrote in this tutorial works just fine.

  • Benjamin Ogg

    Absolutely brilliant! Thank you so much for this!

Leave a Reply to eins walter (Cancel Reply)

 

Related Tutorials..

Pro
How to Query WordPress Taxonomy Terms by Hierarchy Level in Bricks

How to Query WordPress Taxonomy Terms by Hierarchy Level in Bricks

How to limit the terms of a Bricks Terms query to only those at a specific level within the taxonomy hierarchy.
Categories:
Auto Responsive Grids in Bricks

Auto Responsive Grids in Bricks

This tutorial provides the CSS that can be pasted for automatic responsive grids in Bricks Builder. Posts element Each post will get a right padding…
Pro
Recently Viewed Posts Bricks Query Loop

Recently Viewed Posts Bricks Query Loop

How to output the most recent X number of posts (any post type) viewed by the current visitor.
Categories:
Pro
ACPT Gallery Field Query Loop in Bricks

ACPT Gallery Field Query Loop in Bricks

How we can output images from ACPT‘s Gallery field for posts as a grid using a query loop.
Categories:
Posts Related by Current Post’s Terms in Bricks

Posts Related by Current Post’s Terms in Bricks

Showing other posts assigned to the same categories/tags/custom taxonomy terms as the current post.
Categories:
How to create a dynamic infinite logo slider with ACF and Bricks

How to create a dynamic infinite logo slider with ACF and Bricks

This tutorial provides the builder settings, PHP & CSS codes that can be pasted in order to create an infinite logo slider in pure CSS…
Displaying SureCart Featured Products & Products Collections with a Query Loop

Displaying SureCart Featured Products & Products Collections with a Query Loop

We walk through how to use a query loop to display SureCart products, featured products & collections.
Categories: