We have a custom post type that we are currently using to show product offers (non related nor linked to WooCommerce), and we are using a custom field inside those to classify them as "Ofertas" for those that are normal offers, and "Ofertas Flash" for those that are more relevant because will decay over time.
We are showing them in our website in two different URLs which use two different views.
In the homepage, you can find a header called "Ofertas Limitadas" which shows a slider with those items.
Can be seen here: hidden link or in attached screenshot "Home.jpg"
We also have a different view for the same CPT in the following URL: hidden link
As you can see, some of them are blue colored for the normal offers (Ofertas), and some of them are red colored that belong to the flash sales (Ofertas Flash), to do so we are just using the "Tipo de oferta" custom field.
Everything said untill the moment is working properly and as we expect, but what we failed to achieve is to automatically sort both views in a way that the "Ofertas Flash (red ones)" are always shown first. If you take a look, you will see that its already happening, but thats only because we are manually modifying the created post time to make "Ofertas Flash" be posted recently.
Is that possible to be done?
Resume:
Custom Post Type Name: "Ofertas NORMALES y FLASH"
Associated Custom Views to be sorted: "Ofertas 2022 Slider", "Ofertas 2022 PAGINADAS"
Desired Sort: Based on "Tipo de oferta" custom field, showing "Ofertas Flash" as first
Thanks you so much in advance for any help you could bring,
Hello. Thank you for contacting the Toolset support.
What if you edit your view that displays the slider and then navigate to the "Ordering" section and set your view to order by "Tipo de oferta" custom field ASC - does that help?
In this case our custom field "Tipo de oferta" is not showing up.
Could ths happen because it is a verification checkbox input? In case this is not a valid criteria to order the resuls, what could be a good alternative for this field that allows us to not write "Oferta" or "Oferta flash" in every item, and allows us to simply pick the value?
I need to check your structure and how you configured the field "Oferta flash".
Can you please tell me to what post type you assigned the "Oferta flash" field and where I can see it.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) 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 have set the next reply to private which means only you and I have access to it.
The topic ‘[Closed] Sorting by custom values’ is closed to new replies.