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 611 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
Post Views Counter Query Loop in Bricks

Post Views Counter Query Loop in Bricks

How we can output the most viewed posts in your Bricks site in a query loop.
Categories:
Pro
Custom Nested Queries in Bricks

Custom Nested Queries in Bricks

In most of the previous tutorials covering nested query loops in Bricks on this site, we accessed the parent query's looping object in the inner…
Categories:
Pro
Posts Grouped by Taxonomy Terms in Bricks using BricksExtras’ Dynamic Table and Pro Tabs

Posts Grouped by Taxonomy Terms in Bricks using BricksExtras’ Dynamic Table and Pro Tabs

How to output any post type, with the taxonomy terms as Tab titles and posts inside tables with sortable columns.
Filtering Bricks Posts Query Loop by Meta Box Group’s Radio Subfield Value

Filtering Bricks Posts Query Loop by Meta Box Group’s Radio Subfield Value

In the past we showed how a Bricks posts query loop can be filtered by Meta Box group's subfield of types text/number and Datepicker here.…
Categories:
Pro
Related Posts by Taxonomy in Bricks

Related Posts by Taxonomy in Bricks

In the previous Posts Related by Current Post's Terms in Bricks tutorial, we showed how posts related to the current single post that have the…
Categories:
Pro
Masonry for Query Loop in Bricks

Masonry for Query Loop in Bricks

If you are looking to implement masonry with a 'view more' button i.e., click-type of infinite scroll follow this tutorial instead. Updated on 15 Mar…
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:
Pro
Accordion Grid Query Loop in Bricks

Accordion Grid Query Loop in Bricks

How to set up a accordion in Bricks such that the "titles" are arranged in a grid with the full width content opening below.
Categories: