Saltar navegación

[Esperando confirmación del usuario] Pagination Doesn’t Appear to Work with Year Grouping of Posts

This support ticket is created hace 1 semana, 6 días. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Este tema contiene 8 respuestas, tiene 1 mensaje.

Última actualización por Minesh hace 6 horas, 36 minutos.

Asistido por: Minesh.

Autor
Mensajes
#2806501

I am trying to implement pagination in a View that utilizes year grouping functionality as laid out in this post:
https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/

I have my View markup as follows:

[wpv-layout-start]
	[wpv-items-found]
	<ul>
	<!-- wpv-loop-start -->
		<wpv-loop>
          	[heading condition="year" value="[wpv-post-date format='Y']"]
          		<li class="resource-month-header"><h3>[wpv-post-date format='Y']</h3></li>
          	[/heading]
          	<li><a href="[types field='document-attachment' output='raw'][/types]" class="resource reports" target="_blank" aria-label="download [wpv-post-title] pdf">[wpv-post-title]</a></li>
		</wpv-loop>
	<!-- wpv-loop-end -->
	</ul>
    <div id="post-pagination">
        [wpv-pagination] 
            [wpv-pager-next-page]Next[/wpv-pager-next-page]
            [wpv-pager-prev-page]Previous[/wpv-pager-prev-page]
        [/wpv-pagination]
    </div>
	[/wpv-items-found]
	[wpv-no-items-found]
		<p><strong>There are currently no resources at this time that match your query. Please check back later as they get updated.</strong></p>
	[/wpv-no-items-found]
[wpv-layout-end]

The view, labeled "Resource Links (Grouped by Year)", is configured to display 36 items per page. It's acting as if there's a limit of 36 imposed on the view as it only shows that many, but there are 191 posts in total.

The view output is grouping the posts by year as expected but the pagination configured into the view is not displaying.

Link to a page where the issue can be seen: enlace oculto

Any help in this matter would be greatly appreciated. Thanks in advance.

Please note that port 2222 is required in order to gain sFTP access to the site's files.

#2806776

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You did not added the pagination shortcode. I've just added that to "Search and Pagination" section of your view:
=> enlace oculto

[wpv-pager-nav-links output="bootstrap" first_last_links="true" previous_next_links="true" force_previous_next="true"]

However it has the CSS conflict with the existing child theme CSS that you should correct it.
=> enlace oculto

Pagination links does display at top of the page:
- enlace oculto

#2806789
Screenshot 2025-04-25 at 09-44-33 Edit View ‹ Erie Water Works — WordPress.png

Full disclosure, I actually do have pagination implemented in my view, it's just in the "Loop Editor" because that's how I've always done it (I've been working with Toolset plugins for a good eight or so years now).

That said, for this view, it appears it's only wanting to work if the pagination is contained within the "Search and Pagination" editor as opposed to the "Loop Editor" where my pagination currently is. I've moved my pagination over to that editor and it looks like it's working like it should (see attached).

Any idea why pagination generally works while in the main "Loop Editor" in most view/archive applications, but in this case it's not? Because I can tell you this is the first time I've ever had to put my pagination in the "Search and Pagination" editor box to get it to work.

#2807296

Christopher Amirian
Colaborador

Idiomas: Inglés (English )

Hi,

Minesh is not available today. He will be back tomorrow, but as a general rule of thumb you should not add pagination directly to the loop editor.

There is a dedicated section as mentioned before.

Thanks.

#2807383

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Do you need further assistance as I see you wrapped the pagination shortcode with conditional shortcode.

#2807412

@Chris but what happens if the design calls for the filters to be above the loop output and the pagination below the loop output? Seems unreasonable to restrict the pagination just to that one box. Plus, it has been working fine up until this point when we've regularly put the pagination in the Loop Editor box instead of the Filter and Pagination editor box.


@Minesh, I wrapped my pagination within conditional logic because of the particular styling of its immediate parent container. I realize if they weren't wrapped in a parent container, I wouldn't need the conditional logic because nothing would output if the pagination wasn't needed.

#2807474

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Can you please share details where exactly at what place you want to display pagination?

Please share screenshot and I will check further.

What if create a brand new test view and place the pagination at your desired place - do you see it working?

#2807857

Well, in this application, moving the pagination to the "Search & Pagination" box wasn't an issue because I'm not using filtering controls for this view output. I just moved the [wpv-filter-meta-html] shortcode under the [wpv-layout-meta-html] shortcode in the "Output Editor" box and that worked sufficiently.

My inquiry now is in regards to what Chris said. He said that I should have pagination in the "Search & Pagination" box as opposed to the "Loop Editor" box, as I have been doing for years with your plugin. I want to know why all of sudden it's not working in this one view in particular (perhaps because of the custom code?) and what should I do in a future application where the design spec calls for the filter controls to be above the loop output and the pagination to be under the loop output?

Usually I'm not employing pagination directly in a View anyway, but rather in a WordPress Archive configuration, however sometimes it is required, and I figure I'm just going to continue with how I've been placing pagination for years unless there's a problem with the pagination displaying like in this case.

I'm just wondering how you guys expect pagination to always be included in the same box editor as the filter controls, is all, if that is why I'm having this particular issue in the first place.

#2807939

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

You can also add pagination to loop editor as well.

You can auto-login to the sandbox site using the following link:
=> enlace oculto

I've set pagination to two items per page with the following view and added pagination to "Loop Editor" section:
=> enlace oculto

I just checked by adding pagination to Loop Editor section and it does works as expected as you can see with the following test page:
=> enlace oculto