Skip Navigation

[Resuelto] Populating search value from custom post

This support ticket is created hace 6 años, 3 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Luo Yang hace 6 años, 3 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#1092503

Tell us what you are trying to do?

I have a custom post type created called "Property". As part of the content template I want to create a search with an automatically populated field (property-id) that pulls the value from the current post that is being displayed. Is this possible?

What is the link to your site?

enlace oculto

#1092835

Hello,

I suggest you try the WordPress built-in post ID field, which is also a unique value, for example, you can display current property post ID with Views shortcode [wpv-post-id]:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-id

#1093242

That's great. How do I now add that in as a pre-defined value in a search form?

#1093660

Hello,

I assume you are using shortcode [wpv-control-postmeta] to display the field in search form, see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-postmeta

There isn't such an option to "add that in as a pre-defined value in a search form".

As a workaround, you can pass URL parameter to the view, for example:
enlace oculto

It is passing URL parameter "wpv-wpcf-property-id", value 20, see it in the field "Property ID", it is populated with value 20