Saltar navegación

[Resuelto] Filter posts by content from multiple lines – custom field

This support ticket is created hace 4 años, 7 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 1 respuesta, tiene 2 mensajes.

Última actualización por Minesh hace 4 años, 7 meses.

Asistido por: Minesh.

Autor
Mensajes
#1625249
Screen Shot 2020-05-15 at 09.27.03.png
Screen Shot 2020-05-15 at 09.20.12.png

Hi,

we have custom posts with several custom fields. One of these fields is a multiple line field, where we add several postal codes/zip codes. One per line like in Woocommerce shipping fields. We would like to filter by the content from this multiple lines. How can we add a filter like:

"Show all results where the inputed search term starts with the same word like in the multiple lines box."

So the thing is, that we have complex post codes in the UK. Eg.: "EC2A 3AY".
Important is the first part of the post code "EC2A" This part is set in the multiple line field. Each row one starting term of a post code.
It is important that when a user is searching for his post code, lets say "EC2A 123A" and we have "EC2A" in the custom field, it should show the custom post.

you

#1625593

Minesh
Supporter

Idiomas: Inglés (English )

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

Hello. Thank you for contacting the Toolset support.

The only way to search that field as per your requirement is you should add a text search to your view:
=> https://toolset.com/documentation/user-guides/views/filtering-views-for-a-specific-text-string-search/

But when you add the text search, you can search within the post title OR post title and post body. To search in the multiline custom field, you need to add Relevanssi plugin and we have integration with Relevanssi
=> https://toolset.com/documentation/user-guides/views/searching-texts-custom-fields-views-relevanssi/

You need to register your custom field:
=> https://toolset.com/documentation/user-guides/views/searching-texts-custom-fields-views-relevanssi/#registering-custom-fields

And you can follow the following steps:
=> https://toolset.com/documentation/user-guides/views/searching-texts-custom-fields-views-relevanssi/#integration-with-custom-searches

I hope the above information will help you to resolve your issue.