Skip Navigation

[Resolved] How to set shortcode parameter values with views parametric search form

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.

This topic contains 4 replies, has 2 voices.

Last updated by Brad 5 years, 5 months ago.

Assigned support staff: Adriano.

Author
Posts
#286349

I am trying to: set parameter values of a shortcode using Views parametric search. The shortcode is currently set up to work with the below structure:

[[shortcodename param-1=value-1 param-2=value-2 param-n = value-n]]

To make the shortcode more interactive I would like to use a Views parametric search form to redisplay the shortcode whenever the user changes any search form input. Can I use the shortcode in a Content Template and display it with a View?

Please suggest how I can best accomplish this with Views. I can add or modify code of the shortcode if Views cannot easily supply the parameters in the current shortcode structure.

Thank you for your help.

#286490

Hi Brad,

The only way to pass this information is through POST or GET. But you can't pass those kind of values into a shortcode attribute, that's a WordPress thing.

Please let me know if you are satisfied with my reply and any other questions you may have.

Regards,

Adriano Ferreira

#286573

Hi Adriano,

If as you say I cannot set the shortcode parameter values from the Views parametric search form, then how can I access those values from within the shortcode's PHP code? Can I read them from $_POST or $_GET?

I don't really care how I get the values, I just need to get them so that I can use them in the shortcode's PHP code.

Please suggest how I can best accomplish this so that any user input changes in the Views parametric search form are immediately reflected in the output of the shortcode.

Am I clear about what I am trying to do?

Thanks.

Brad

#286977

That's not possible. You can not get an URL parameter of a Views parametric search in a shortcode attribute.

If the shortcode you are using is the Views one, [wpv-view attribute=""], I'd recommend you to change this filter for by URL parameter instead of by shortcode argument.

Please let me know if you are satisfied with my reply and any other questions you may have.

Regards,

Adriano Ferreira

#292581

I resolved my issue without Views by writing my own shortcode with an AJAX callback function.