I want to have three Views of a CPT where each view is sorted alphabetically by Post Title and filtered to group the posts into A-L, M-R, and S-Z. Filtering by only the first character of the post title is not sufficient in this case, as it will result in listing that are not purely alphabetical.
I have other Views where the sorting and filtering is by a Date field, and for those views, selecting a range of dates is simple before the Date field can be selected in a pair of filters, one filtering for 'greater than' a certain date value and the other 'less than' a different date value. Why is that possible for Date fields but not for String fields?
I'm totally happy to wait for Christian's availability on this particular ticket!
Hi,
Thank you for contacting us.
Christian won't be available before Sunday, so I hope it is fine if I reply to this ticket.
At the database level, the date field values are stored in numerical Unix timestamp format ( ref: hidden link ), whereas the string fields can consist of a combination of numbers, alphabets, or even special characters.
As performing numerical and comparative operations on alphanumeric data can result in unexpected results, they are only offered for the numerical fields.
For what you're planning to achieve the most efficient and simple approach would be registering a new custom taxonomy (let's call it something like "Alphabetical Groups") and add these 3 group names as 3 terms:
1. A-L
2. M-R
3. S-Z
This way you'll not only have full control over which post should belong to which group, but filtering the posts on the front-end using these taxonomy terms will be more efficient in terms of performance too.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
My issue is resolved now. Thank you!