Skip Navigation

[Resolved] Using Next/Previous Buttons

This support ticket is created 5 years, 10 months 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 2 voices.

Last updated by Beda 5 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#1191314

This is an archive page - hidden link

Each thumbnail will link to that custom post type I created. On that page I want to have each box on the side indicate what number in the series the image is, plus a link to the next one or the previous one in the series.
This is what happens currently - hidden link
But I want previous/next navigation like this - hidden link

That second link is a paginated view. It works, but I was moving away from that because I could not figure a way to link from a thumbnail image on a different page to a specific item in the pagination.

Let me know if you need more information.

#1191424

I understand you use the single item pagination ShortCodes provided by Views [wpv-post-next-link] and [wpv-post-previous-link]?
They do not feature the current page or total amount of page attributes.

Toolset itself also features no ShortCode to return the current or total amount of posts in such a loop.
This could be requested as a feature, here:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Currently, you can, for example, create some Custom ShortCodes to get the total amount of posts of that type, and outputs it, so you can use it to display the number of posts (or, but this is overkill, create a view that returns that number).
For the current post, you would also have to use custom code, which requires some knowledge of the WordPress Query (example https://wordpress.stackexchange.com/questions/12372/get-the-current-page-number)

The sort of pagination with the amount of all posts and current post is possible only in a View Loop, using Toolset, it is one of the core features of Toolset.

Please let me know if you require help setting up such a view (and link to particular pages in that View from somewhere else)

#1192126

Beda, perhaps I am not being clear, so my apologies.

I had already figured out how to the type of navigation I want - hidden link.

The issue is this. I would like to have a page that has thumbnails, like this page - hidden link. BUT, when a user clicks on a thumbnail I want them to go to a page that has the navigation to the left and right of the image like this one does - hidden link. That is my dilemma. Is this possible...to easily jump from a thumbnail to a specific item in a loop AND have pagination?

#1192414
Bildschirmfoto 2019-01-29 um 16.14.52.png

Going to a different page and going to a different location in a loop is something different.

Targetting a specific item in a loop of views (pagination item) should be possible.
Since a paginated View adds parameters to the URL, ?wpv_view_count=73-TCPID75&wpv_paged=2, you can link to those page with the View, from the archive, passing an URL parameter, that satisfies the above Views one for pagination.

In your archive, you likely show the posts as they will be paginated, so the first item in the archive's loop, will be without pagination attributes, but just leading to the page with the view, paginated by one (It always will show the first in the loop).
Then, the second item in the archive loop needs to lead to the same page but with ?wpv_view_count=73-TCPID75&wpv_paged=1 added.
So for that, you can add some custom code to count the view's loops (current) iteration as explained here.
https://toolset.com/documentation/adding-custom-code/count-the-number-of-views-loop-iterations/

Then, in the Archive View, you would create the link to the page where you paginate the posts, by adding something like this to the loop:

<a href="[wpv-bloginfo show='url']/page_with_view/?wpv_view_count=73-TCPID75&wpv_paged=[tssnippet-loop-iteration]">Link to single</a>

The value of wpv_view_count is taken from the HTML where the paginated View is inserted, see screeshot.
The rest is dynamically created and will always lead to the "Paginated" item as according to how it is output in the Archive Loop.

This link can be added to any image, of course, or text string.
Hence, hidden link, which is the archive, is where you use that above link.
Then, on any page, you insert the View that you have already which is currently here:
hidden link
It would let you achieve the described goal.

Please let me know if this helps and/or you need further details