SOLVED: Pagination rendering problem on archive page

Browser: Chrome 115
OS: Windows
URL: wordpress – Try Bricks – t7b3ff1b

Hi bricks team,

If we use the pagination element for query loop on a page and the number of posts is not enough for pagination, we see in the front end that no div of the pagination structure is rendered. There is no problem here and everything is fine.

But if we use the pagination element on the archive template and the number of posts is not enough for pagination, a div of the pagination element will still be rendered (image below).

In general, if the number of posts is not enough to display the pagination, no html tags from the pagination element should be rendered in the frontend. Please note that this problem does not exist in wp pages and only in archive pages (posts and products).

1 Like

Hi @HOSEIN,

Thank you for your report. I couldn’t replicate this locally with a normal query loop on posts (both on a page and an archive template). Can you please share the query loop’s settings or steps to reproduce the bug?

Hi again @charaf,

Please check this template. I hope it is useful.

Hi @HOSEIN,

I’m still not seeing the pagination element with your template (on an archive template):

Can you please double-check if you’re selecting the correct container as I noticed it was some random ID when I first imported your template:

Hi @charaf, Please watch the video below. Your screenshot shows the main section of the page. The problem is that a pagination tag is rendered while there are not enough posts for pagination and the pagination element is disabled.

https://drive.google.com/file/d/1SIvSCBd7A2eTkpqwsmrFg3zJYoO-uJvt/view?usp=sharing

Can you please double-check if you’re selecting the correct container as I noticed it was some random ID when I first imported your template:

This might be a bug. In bricks, if we copy a query loop along with the pagination (which is connected to it) and paste it into another page, this problem occurs.

But this problem does not exist on a page (other than the archive). Please see the video below. When there are not enough posts for pagination, the pagination html code is completely removed from the page. But this is not the case in the post and product archive.

https://drive.google.com/file/d/1dVKB2A3GvDt6Jz_bLU1Zu550c9Rrsp_n/view?usp=sharing

Hi again @charaf,

I don’t know if you were successful in reproducing this bug or not. But let me explain this in more detail this time.

Let’s say we have an archive for posts and display the number of 9 posts on each page of the archive. These posts also have categories.
Now, if you see a category whose number of posts is less than 9, the pagination element will be hidden, but there is still a div of it in the html structure. And this will leave an empty space for pagination on the page.

You may be wondering what is the reason for removing this div from the pagination element?
Because in this case, I can remove the empty space in this situation by using the following css.

root:empty{
display: none;
}

root is actually the parent div of the pagination element.

Hi @charaf,

This bug has been fixed in the new version.

cheers🥂

1 Like

Hi Hosein,
You say that the bug has been fixed. However, I still run into it. How is this solved?

Hi @pzeylstra, Yes, the problem is solved. Could you please share a template of the page where you are experiencing the problem?
As a quick fix, you can use the conditions to achieve your goal.

Screenshot

It is this template: Home vakantiehuismakelaars | Vakantiehuismakelaars
It does work fine when I put the pagination element inside the card. However, that causes the pagination element to show up in every item of the query.

By the way, only select in the filter items that exist of one name. The ones with a space in it don’t work (is a ticket already for a long time).

I don’t see any pagination elements on the page. Am I wrong?

Sorry, didn’t realize I can’t share the template url. It is on this page: Aanbod vakantiehuizen | Vakantiehuismakelaars
It is loading this template: /template/aanbod-vakantiehuizen/