Skip Navigation

[Resolved] Pass a variable to a view

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

Problem:

Use third party shortcode insider Views shortcode [wpv-view].

Solution:

The shortcode within shortcode is a feature of Views plugin, you can register your own custom shortcode here:

Go to Toolset->Settings and click on the Front-end Content tab. Look for the section called Third-party shortcode arguments

Relevant Documentation:

https://toolset.com/documentation/user-guides/shortcodes-within-shortcodes/

This support ticket is created 5 years, 6 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
- 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)

This topic contains 2 replies, has 2 voices.

Last updated by Kostas 5 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1098440

Hi,

I am currently using a view successfully into a page, like this:

[wpv-view name="grandparent-view-taster-users" cached="on" groupyear="[wpv-user field='wpcf-taster-group']"]

Now, on another page, I need to use same view but groupyear to come from a shortcode I have built, like this:

[taster_group_year_select_form]
[wpv-view name="grandparent-view-taster-users" cached="on" groupyear="???"]

How should I pass the variable $tasteryear coming from the shortcode, into groupyear of the view?

Thanks in advance,
Kostas

#1098467

Dear Kostas,

The shortcode within shortcode is a feature of Views plugin, you can register your own custom shortcode here:
Go to Toolset->Settings and click on the Front-end Content tab. Look for the section called Third-party shortcode arguments

See our document:
https://toolset.com/documentation/user-guides/shortcodes-within-shortcodes/

#1098756

That did the trick, thank you Luo!
For those wondering, I registered my custom code as instructed and then used:

[wpv-view name="grandparent-view-taster-users" cached="on" groupyear="[taster_group_year_select_form]"]

Best regards,
Kostas

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.