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 610 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 your comment

 

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:
Pro
Post Data for the Current User in Bricks with Meta Box

Post Data for the Current User in Bricks with Meta Box

How to configure a query loop to output the post data of the SalesRep CPT associated with the current user.
Categories:
Adding any Custom WP_Query loop to Bricks’ Query Loop

Adding any Custom WP_Query loop to Bricks’ Query Loop

Sometimes we may need to create a custom post loop using Bricks' query loop feature, but wish to use our own WP_Query code for more…
Pro
Dynamic Horizontal Posts Accordion in Bricks

Dynamic Horizontal Posts Accordion in Bricks

Update on 8 Sep 2024: You may want to follow the newer version that considers accessibility. Looking to make a Horizontal Image Accordion dynamic? This…
Using WP Grid Builder Facets with Bricks’ Query Loop

Using WP Grid Builder Facets with Bricks’ Query Loop

Update: This tutorial was written before WPGB had a Bricks add-on. Now, it is advisable to use that add-on instead. Get it from here. Updated…
Categories:
Pro
Excluding Duplicate Posts from Query Loops in Bricks

Excluding Duplicate Posts from Query Loops in Bricks

How to ensure that posts are not duplicated when two query loops are used on the same page.
Categories:
Pro
Hierarchical Posts with Nested Query Loops in Bricks

Hierarchical Posts with Nested Query Loops in Bricks

Learn how to set up nested query loops in Bricks to show hierarchical posts with child posts grouped under their corresponding parent posts
Categories: