Skip Navigation

[Resolved] Question about supplying filter attribute values via a shortcode

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to know if it is possible to set the options in a custom search filter using a custom shortcode.

Solution: It's possible, but you must register the shortcode in Toolset > Settings > Frontend Content > Third party shortcodes.

This support ticket is created 5 years, 2 months ago. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by josephC-5 5 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#1367867

Hi there,

There's some filter code in a view that looks like this:

[wpv-control-postmeta field="wpcf-price-range" type="select" source="custom" url_param="wpv-wpcf-price-range" values="3,2,1" display_values="$500+,$250-500,$1-250" default_label="All"]

I want to be able to supply the values of "display_values" attribute via a shortcode, like so:

[wpv-control-postmeta field="wpcf-price-range" type="select" source="custom" url_param="wpv-wpcf-price-range" values="3,2,1" display_values="[get_display_values]" default_label="All"]

In the above pseudo-snippet, "[get_display_values]" would return three comma-separated values (to correspond to the "values" attribute) that come from elsewhere. For example, it might be "$1000+, $750-1000, 250-749."

Is that possible?

Saul

#1367963

Hello, yes it is possible, but you must go to Toolset > Settings > Front-end Content and register get_display_values in Third-party shortcode arguments in order to be able to use the custom shortcode in another shortcode attribute.

#1368165

Thanks, Christian!

Saul