Skip Navigation

[Resolved] Help setting up a secondary paginated list

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client would like to add pagination links on single custom posts that paginate within the list of posts that was generated by a View.

So there is a View which lists some custom posts. Clicking a post takes you to that post. There should be links to the previous and next posts from the source View.

Solution:
There are no such pagination links available, but it is possible to contrive a solution that works using two Views.

See the full description below for details: https://toolset.com/forums/topic/help-setting-up-a-secondary-paginated-list/#post-902383

This support ticket is created 6 years ago. 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Ying Zhang 5 years, 12 months ago.

Assisted by: Nigel.

Author
Posts
#902305

Tell us what you are trying to do?
Hi Nigel, I finally got around to try implement a new paginated list for the site hidden link

Please have a look at the site, and visit the "Artists" page, from that page, select any artist.

In the artist profile page, near the bottom there is a list of the artworks the selected artist has produced.

Click on any of the artwork in the list will open up the artwork page. With detailed information for that piece of art.

Currently, to view another art by this same artist, you need to click "Back" in the browser and select another piece of artwork.

What we are trying to achieve is to add another paginated list, so that, when viewing any artwork, you can press "Prev" and "Next" to scroll to the prev/ next piece.

It's been a year since I worked on this project and used Toolset. I feel a bit lost. You gave me some tips previously.

Quoted:
"Regarding the pagination, it is not dependent on the plugin version.

To create the correct links you would need to make that second View that displays just one post at a time and includes next/prev navigation links. Add that to a page and use the navigation links to move between the posts. Note the full URL in the address bar as you do so.

These are the URLs you would need to reproduce for your links in the first View. I haven't tried it to see what is required for the URLs or how to reproduce them, but I can't think of any other way to do this.

If you try that and run into problems could you please create a separate ticket for it. You are welcome to assign it to me."

Currently, the list of artworks on the artist profile uses a Content Template for the individual items:
<div style="display:inline-block;">
[wpv-post-featured-image size="custom" width="250" height="250" crop="true"]<br>
[types field='artwork-title'][/types]
<div style="height: 30px;"></div>
</div>

So each icon links to the Artwork post directly. How do I make i link to a "second view" instead?

And on the 2nd view, how do I create the prev/ next links and where should they link to?

Thanks for helping with this, I hope I can get up to speed with Toolset again.

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/views-pagination/

Is there a similar example that we can see?

#902383

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screen Shot 2018-05-23 at 11.04.20.png

I assume that your artworks are child posts of your artists.

I set up something similar on a local test site where I have House >> Room custom post types where rooms are child posts of houses.

On the template for single houses I have inserted a View which displays the rooms belonging to that house.

Normally, when I click on a link to a room it will take me to the single room post, but I'm going to modify that so that I can add previous / next links to navigate between the rooms of the same house without having to go back to the house post itself.

To do that my links will no longer go to the single room posts, but instead to a page where I add a View that will show just one room belonging to the house in question, with pagination links to move back and forth between the rooms of that house.

So, let's start by making the second View, which will be a View with pagination.

It will, in my case, list rooms. I'm just outputting the titles, you will be outputting the artwork pictures.

I set the pagination options to only display one post at a time, and insert prev / next pagination controls in the filter editor.

I will need a Query Filter to specify the parent house. But I won't be inserting this View onto the house template (I'm adding it to a page) so I can't set the house based upon where this View is shown, I will need to pass the ID of the parent house post using a URL parameter.

You can see where I do that in the screenshot.

By default Views suggests wpv-pr-child-of as the name for the parameter, but you can change it to anything you want.

So, I now insert this View into a page that I'm going to use to display a single room, instead of the room post itself.

I'll need to know the ID of the page.

I go back to my original View that displays rooms belonging to a house and edit it.

In the Loop Output section where I was previously linking directly to the individual room posts with the wpv-post-link shortcode, I now replace that with a link to the page where I added the second View and I add the URL parameter to identify the parent house.

That looks like this:

		<wpv-loop>
          <p><a href="[wpv-post-url id='64']?wpv-pr-child-of=[wpv-post-id id='$house']">[wpv-post-title]</a></p>
		</wpv-loop>

'64' is the id of the page that contains my second View. '$house' is the slug of my parent post type.

You should be able to reproduce the same on your site using the same steps, where you use artist and artwork in place of house and room.

Let me know how you get on.

#906653

Thank you Nigel! I have been able to follow your example and complete the work!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.