Skip Navigation

[Cerrado] Sorting with VIP/Featured listings always at the top of other results

This support ticket is created hace 8 años, 5 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Etiquetado: ,

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Shane hace 8 años, 5 meses.

Asistido por: Shane.

Autor
Mensajes
#359124

Hi,

I am using the Classifieds template and I want to filter the VIP (wpcf-featured_ad) listings at the top of the loop regardless of what others sorting is used.

Is there a way to achieve this without creating two Views because this isn't exactly a solution and not to mention that this it is even impossible because if the field "wpcf-featured_ad" is not present in the DB as post meta then you can't use it in the View Query Filter.

Thanks,
Jordan

#359236

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Margarit,

Thank you for contacting our support forum.

Taking a look at your request, I must say that this is not possible with the use of only 1 view 🙁

The reason for this is that the sorting algorithm will always sort all the information it is displaying. This means that the featured set wont be able to be sorted differently from the non-featured set.

However you do have the option to sort the view by the value of the custom field used to Identify the featured items. This would allow the featured items to show up first then all other items will show up next.

Please let me know if this helps.

Thanks,
Shane

#359453

Hi Shane,

However you do have the option to sort the view by the value of the custom field used to Identify the featured items. This would allow the featured items to show up first then all other items will show up next.

Intentionally, this would be true, however it is not. If I set the query filter to sort the view by the value of the custom field it only returns the listings that does have this custom field as meta data stored in the DB and the rest are skipped and not displayed.

For instance:
I have 3 listings - 2 of them have the custom field VIP checked. In the DB (wp_postmeta table) those with the VIP field checked have a row with 'wpcf-featured_ad' as meta_key and value 1. The third listing doesn't have this row at all. So the query returned will only contain 2 listings skipping all other listings that are missing this field.
I am assuming this is a bug in the plug-in rather than the logic that the plug-in works with.

Thanks,
Jordan

#359491

Shane
Supporter

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Margarit,

Thanks for the clarity 🙂

Actually what have here is not a bug because if the value is empty there isn't anything to sort.

So a work around for this is that you can set the custom field with a default value, assuming that you are using Types then the only posts that will have a different value is the ones that are featured.

Please let me know if this was clear.

Thanks,
Shane

El debate ‘[Cerrado] Sorting with VIP/Featured listings always at the top of other results’ está cerrado y no admite más respuestas.