Currently, I am trying to create an alphabetic pagination with ranges for a custom post type on a custom field using this code from kathy is awesome. I have gotten everything working except for the range aspect of it. Such as A-E, F-H and so on. Any help would be great. Thanks.
1 comment
Comments are closed.
If you have used that code, now you have a custom taxonomy called ‘glossary’, what you need to show the range is a custom query like
The problem is how to perform this query with a url?
You can make use of an endpoint, something like
Doing so, when you visit the link
http://example.com/letters/a-e/
a variable ‘letters’ is added to the query and you can intercept it and use for your scope usingpre_get_posts
hookNow you have to visit the Settings->Permalinks page on your backend and save changes to flush rewrite rules and then you are done.
Now probably you have to create a fucntion to show the link to range pages, something like: