I am trying to: Sort the order of the results in an archive
Link to a page where the issue can be seen: lien caché
I expected to see: The results with a value of '9' in the is_paid_listing field should be at the top of the list. I have included the value in the front end, just so I can see what's happening.
Instead, I got: No sorting at all
When I add secondary random sorting, they all sort randomly. So it's almost as if it is ignoring the value of my selected field
Hi, I'll be glad to help get this sorted appropriately. Can you share screenshots showing the WordPress Archive editor in wp-admin, as well as the Loop Output and any Content Templates you are using to display these results? I would like to see how everything is configured so I can offer the best solution.
Hi Christian,
Some screenshots attached!
I have a conditional tag on the header, whereby if the is_paid_listing = 9 then it will show Post Title with a link. If is_paid_listing = 0, then it'll show the Post Title without a link. This is working perfectly, so it must be reading the 0 and 9 correctly, I just can't get it to sort on them.
Thanks,
J
PS - happy to give admin access if it's easier. Where can I send these details?
Sure, I have enabled private reply fields here to share login credentials confidentially.
Quick question - have you tried to modify the "Order by" options to choose "as a number" instead of "as a native custom field"? Does that have the intended effect?
I have tried that, I'm afraid.
I've also tried using a 'true/false' field type that gives values 1 or 0. I've also tried using a radio field that returns values 'paid' and 'free' and sorting by string, but I'm afraid I haven't been successful sorting on any of them 🙁
Okay thanks, I see now that your custom fields are defined by the Advanced Custom Fields plugin and not by Types. I'm able to sort a View by a radio ACF field, but unable to sort a WordPress Archive by the same ACF field. I'm reaching out to my 2nd tier support team for some clarification here. It may be the case that we are not able to use these values in a WordPress Archive order-by clause for some reason. In the meantime, one option is to create a View that sorts by this radio field and use that instead of the WordPress Archive.
Please stand by and I will update you when I have some additional information about ACF and WP Archive integration.
It appears that this field must be managed by Types in order to be used to sort an Archive. To do that, go to Types > Post Fields and click "Post fields control" at the bottom of the screen. Hover over this ACF field in the list of fields and click "Manage with Types." You should then be able to sort your archive based on this custom field. Our 2nd tier support team has escalated this to our developers as a consistency issue, and I'll keep you posted here as we work to resolve that. For now, the workaround is to manage this field with Types.
Hi Christian,
Thanks for the reply!
I can't manage this field with Types as all of my other fields are dependant on the value of it, unfortunately.
It's a field that will flag whether or not to show subsequent fields.
Do you have a time frame for looking at this?
At the moment the site is still in development, but I will need it to be functional before I launch. As the field flags if it's a paid listing, they need to appear at the top of the listings, before the free ones.
Thanks,
Jean
Unfortunately I have not yet received any timeline for delivery of the fix for this issue. I will let you know as soon as I have some more information to share.
Hi, my 3rd-tier support team reports that this issue has been resolved. Please update to the latest versions of WordPress, ACF Pro, Types and Views and let me know if the problem is not fixed.