Home › Toolset Professional Support › [Resolved] Link Text for Pagination Controls
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)
Tagged: Paginated lists, Views plugin
Related documentation:
This topic contains 13 replies, has 2 voices.
Last updated by Minesh 6 years, 5 months ago.
Assisted by: Minesh.
In my paginated View (which displays one post per page), I'd like to display the custom post title as the link text instead of 'next' or 'page x'. I've tried [wpv-post-title] but this outputs the title of the page where the View is shown not the title of the custom post being returned by the View.
How do I achieve this please?
Hello. Thank you for contacting the Toolset support.
Well - you can use view's shortcode [wpv-post-next-link] and [wpv-post-previous-link] to display the pagination links - it supports the place holder %%TITLE%% .
For example:
[wpv-post-next-link format="%%LINK%% "" link="%%TITLE%%"]
More info:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-next-link
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-previous-link
Hi Minesh
Thank you for this. I've tried it but the link text returned is a (random?) page title - it's not the title of the page where the View resides and it's not the title of the custom post (which is the desired text). Any ideas why this is so far from what I'm trying to achieve?
Well - I would like to know where exactly you added the pagination links?
Could you please share problem URL and access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
I'm afraid this is a development site that's completely locked down. What sort of things can I check myself to trouble shoot this?
Well - following is the complete guidance that will guide you how you can use pagination:
=> https://toolset.com/documentation/user-guides/views-pagination/
=> https://toolset.com/documentation/beyond-the-basics/paginate-lists-of-content/
You should check with default theme and check if pagination works with default theme.
I'm using Astra - one of your recommended themes so I wouldn't expect this to be an issue but nevertheless I can confirm that the default options all display pagination correctly.
How exactly should I be incorporating this shortcode?
[wpv-post-next-link format="%%LINK%%" link="%%TITLE%%"]
The only way I can get it to work is with the pagination section looking like this:-
[wpv-filter-start hide="false"] [wpv-filter-controls][/wpv-filter-controls] [wpv-pagination]<ul class="pagination"> <li class="page-item">[wpv-pager-prev-page][wpv-post-next-link format="%%LINK%%" link="%%TITLE%%"][/wpv-pager-prev-page]</li> <li class="page-item">[wpv-pager-next-page][wpv-post-previous-link format="%%LINK%%" link="%%TITLE%%"][/wpv-pager-next-page]</li> </ul>[/wpv-pagination] [wpv-filter-end]
but only the 'previous' one displays a link and that is to the previous page I was on, not the previous custom post in the list. It doesn't display a link to the 'next' one because it doesn't know where I'll go next (!).
I've set this up by the way on a totally brand new install to rule out any conflicts.
If you can confirm whether I've actually added the shortcode correctly, we can go from there. I'd prefer to give you a duplicate site to look at your end if needs be.
Thanks
The only way I can get it to work is with the pagination section looking like this:-
[wpv-filter-start hide="false"] [wpv-filter-controls][/wpv-filter-controls] [wpv-pagination]<ul class="pagination"> <li class="page-item">[wpv-pager-prev-page][wpv-post-next-link format="%%LINK%%" link="%%TITLE%%"][/wpv-pager-prev-page]</li> <li class="page-item">[wpv-pager-next-page][wpv-post-previous-link format="%%LINK%%" link="%%TITLE%%"][/wpv-pager-next-page]</li> </ul>[/wpv-pagination] [wpv-filter-end]
=======>
Well - pagination shortcodes will work in relation to the one currently being viewed. That is why we have two kind of shortcodes (for page and for post)
For posts:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-next-link
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-previous-link
For page:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-pager-next-page
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-pager-prev-page
So the shortcode should work as per the content you display. If you are display custom post type post with your view - you should use posts pagination shortocdes.
You should not combine both.
Please be good enough to provide an example of the code that should sit in the pagination section which uses the [wpv-post-next-link format="%%LINK%%" link="%%TITLE%%"] and [wpv-post-previous-link format="%%LINK%%" link="%%TITLE%%"] shortcodes.
Thank you
Well - I think I was not clear enough and you do not understand the usage of those shortcodes.
[wpv-post-next-link format="%%LINK%%" link="%%TITLE%%"] and [wpv-post-previous-link format="%%LINK%%" link="%%TITLE%%"] shortcodes can be used when you are displaying single post of any post type.
For example:
- you have post type "Student"
- you have created the content template to display the single post of student
- with this content template that display the single student content
- In this case, you can use the above shortcode and this shortcode supports placeholder %%TITLE%% as you can see with our Docs:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-next-link
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-previous-link
So, if you display a single post above shortcodes will work which is capable to display the TITLE.
Now, with view's pagination, you can display the pagination links using following shortcodes:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-pager-next-page
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-pager-prev-page
As you may have notice - [wpv-pager-next-page] and [wpv-pager-prev-page] does not support placeholder %%TITLE%%. As you may have notice with our Doc as well:
=> https://toolset.com/documentation/user-guides/views-pagination
It's no wonder I'm confused when I'm pointed to using a shortcode that only works on a post when I specifically stated I was working on pagination in a View.
So if %%TITLE%% doesn't work with [wpv-pager-next-page] and [wpv-pager-prev-page], is there anything that WILL work? (My original question).
I tried populating the value of a custom field in the next post as the link text like this:-
[wpv-pager-next-page format="%%LINK%%" link="[types field='my-custom-field' id='[next-post-id]'][/types]"][/wpv-pager-next-page]
where next-post-id is a registered shortcode to find the next post's ID) but it doesn't work (even though [types field='date-of-birth' id='[next-post-id]'][/types] on its own returns the correct value).
Thanks
So if %%TITLE%% doesn't work with [wpv-pager-next-page] and [wpv-pager-prev-page], is there anything that WILL work?
==> No - there is no such feature available for now but if you agree I can take this request as new feature request and send it for assessment.
Yes please; that would be good. I've seen a number of posts from users trying to achieve the same thing.......
Ok fine - I will pass your concern as a new feature request for assessment to the concern person.