Skip Navigation

[Cerrado] How to add a search field in filter for a title of custom post

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 6 respuestas, has 2 mensajes.

Last updated by simeonov hace 11 años, 3 meses.

Assisted by: Caridad.

Autor
Mensajes
#15842

I am trying to add this field from here (screenshot), but no results when i make a query.
hidden link

Can you help me make a field for title search?

#15899

Dear Simeonov,

Its that simple really, you add the Post Search filter and enable the control just below (Filter Controls, click edit). Make sure you have final releases of both Types and Views.

Which part isnt working? Can I see a URL?

Regards,
Caridad

#16048

Hi CaridadZ,

hidden link
The field for name works for pages and post, but not work for custom post types. This is Product Name Field.

#16209

Can you help me with this issue. I can provide you access. I have to solve this problem before I enter items.
Thanks in advice.

#16210

Dear Simeonov,

I will send you a private email requesting.

Regards,
Caridad

#16417

Dear Simeonov,

Searching wordpress is only looking into post title and post content. You can add a filter to functions.php to change that and make it look in custom fields like this:

add_filter('wpv_filter_query', 'mysearch');
function mysearch($q) {
if(!empty($q['s'])){
  $q['meta_compare'] = 'LIKE';
  $q['meta_value'] = $q['s'];
  unset($q['s']);
}
return $q;
}

This will look for the value in all custom fields instead of title & content. If you want to search for a specific field, you could add $q['meta_key'] = 'wpcf-product-name'

Please let me know if there is anything else that I can assist you with.

Regards.
Caridad

#16552

Thanks CaridadZ
It's working like a charm. You break walls and make a doors 🙂

Best Regards

El debate ‘[Cerrado] How to add a search field in filter for a title of custom post’ está cerrado y no admite más respuestas.