Saltar navegación

[Resuelto] How to order searches by most taxonomies matched

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

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

Supporter timezone: Asia/Kolkata (GMT+05:30)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Oliver hace 5 años, 9 meses.

Asistido por: Minesh.

Autor
Mensajes
#1229935

I would like to set up a custom search of a post type which would return results in the order of most taxonomies matched.

So, for example, the taxonomy in question is "category" and the search filter is set up with category checkboxes: category 1, category 2, category 3, category 4. The user might select three checkboxes and click "submit." Then I would like the results to be ordered by most categories matched. If there are posts that match all three categories, they would appear at the top, followed by those that match two categories, followed by those that match one category.

How to do this?

#1229971

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - there is no such feature available to order by the custom search result based on the taxonomy term selection.

You can set ordering or view by post ID, title, custom field etc..etc.. but there is no feature to display results order by based on the taxonomy term selection.

However, I can guide you with to that available views API hooks that may help you and you should try to write your custom logic:
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query_post_process

Sharing here kind of related ticket the solution is not what you want but you will get idea that will help you to build your solution:
=> https://toolset.com/forums/topic/ordering-a-parametric-search-view-by-taxonomy/#post-617416

If the information shared above does not help, this needs custom programming which is beyond the scope of our support policy. If you need custom programming for your project, please feel free to contact our certified partners:
=> https://toolset.com/contractors/

#1230559

Thank you. I will hire a programmer to write a custom query.