Skip Navigation

[Resolved] [wpv-post-previous-link] and [wpv-post-next-link] sorted alphabetically?

This support ticket is created 4 years, 9 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
- 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: 

This topic contains 4 replies, has 3 voices.

Last updated by nicoleR-3 4 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1592097

Tell us what you are trying to do?
I would like to know if it's possible to use the [wpv-post-previous-link] and [wpv-post-next-link] functions and sort alphabetically instead of by post date. And if not, is there another solution that would work? Thank you.

What is the link to your site?
nakwpn.wpengine.com

#1592615

Nigel
Supporter

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

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

Those shortcodes are just a way of inserting the links generated by the WordPress functions such as get_next_post_link(), where next and previous are determined by the post date.

https://developer.wordpress.org/reference/functions/get_next_post_link/

If you want links to the next alphabetical post you will need to use one or more Views.

The easiest solution would be if you are displaying a single post not at the usual URL for single posts, but at a static page that includes a View to output the posts in alphabetical order, and which includes pagination where only one post is shown per page, and you can then add the navigation controls to move back and forth.

A more complex solution would be to use the normal URL for single posts and in the template for such posts create custom shortcodes to display the links. You can't readily create them using Views, the logic required is too complex.

So the first question is does displaying the single posts at a static page using a View sound like a viable option?

#1592617

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

There is no such option available as it will require to add filters to order your post previous and next links.

Where you need to use the filter hooks: get_next_post_sort and get_previous_post_sort

Please check the following links that may help you:
=> https://wordpress.stackexchange.com/questions/204265/next-previous-posts-links-alphabetically-and-from-same-category
=> https://wordpress.stackexchange.com/questions/73190/can-the-next-prev-post-links-be-ordered-by-menu-order-or-by-a-meta-key

Please check the following related ticket that may help you:
=> https://toolset.com/forums/topic/previous-and-next-post-navigation-when-sorted-by-menu-order/

You need to adjust the code as per your requirement to sort by post title.

#1595075

Okay. Thanks. I think all that is a little beyond my capabilities at this point.

#1595077

My issue is resolved now. Thank you!