I have an archive template for a Custom Post Type with a grid which has a card that has a query loop.
I added a button and set the interaction for the button:
Action: Load More (Query loop)
This worked fine. The loop loads 6 items and the Load More button displays. When clicked it will continue to load 6 items until there are no items left.
This CPT has a category taxonomy. For this Category Archive Template I built it the same way. Unfortunately it does not work.
When I view the front end the page loads fine and the grid has the first 6 items but the “Load More” button displays briefly but then disappears. In fact all buttons on the page display briefly and then disappear.
While this grid with the load more button doesn’t work the other CPT Archive Template grid still works fine.
I then added a Load More button to my search results template and it works fine.
I then went back and tried the CPT Archive Template and it is now broken and doing the same thing as the Category Archive Template. The Load More button displays briefly and then disappears along with all the other buttons on the page.
So what is happening?
One thing to note is that the grids and cards for all 3 templates have the same layout and classes. The only real difference is the Query Loop and the ids of the elements.
I also notice that when I added the button to the Search Template that it magically had the Interaction I wanted already applied. This leads me to believe that Bricks is having issues determining what interaction belongs to what button on the website.
From looking at it I saw the mention of “btn–action” which is a class I use on most of my buttons (from ACSS).
So I looked at the class in the Bricks Builder (by looking at one of my buttons) and saw that there is an a load more interaction tied to the class. I didn’t realize this could be done. So I am not sure if this was a mistake on my part (ie I had the class selected as well as the element when adding one of the interactions) or if this was a Bricks Builder Saving issue…
Anyways I deleted the interaction which fixed all my buttons disappearing.
I then went through and re-added the 3 load more interactions to the buttons and almost everything is working again!
The search and CPT archive load more button is working but the Category archive template one is not. It does not display the button at all when it should. The query is setup to pull just the posts from my CPT. Nothing else is set except posts per page in the query (which is set to 3). I assume that the template itself is restricting the query to return only CPTs that belong to the category being viewed. Could this be causing the problem with the Load More Button? (as the query’s are merged???)