Skip Navigation

[Resolved] Use shortcode to set parameters of views shortcode

This support ticket is created 6 years, 10 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by peterI 6 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#536240

I am trying to filter output of a view using views shortcode parameters - but I want those parameters set by shortcodes that do date calculations. I'm trying to nest shortcodes.

Specifically, I want to show CPTs that have a date field that falls between the Monday of the post that uses the view and the previous Tuesday. This is for a newsletter-type WP post that goes up every Monday and includes a section showing articles read from (from other sources) since the previous Monday post.

Here is a trouble-shooting page I'm trying to get to work:
hidden link

Here is the page code I'm trying to work. The parsing of the shortcode brackets doesn't work.

<h3>Parameters set manually</h3>
[wpv-view name='filter-articles-weekly' startdate='1496666015' enddate='1497270815']

<hr />

<h3>Parameters set using shortcodes</h3>
Shortcode output: startdate = [prev_tue_pub_date] enddate = [mon_pub_date]

[wpv-view name='filter-articles-weekly' startdate='[prev_tue_pub_date]' enddate='[mon_pub_date]']

Or is there a better way? I've tried a number of things.

#536251

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Thank you for contacting our support forum.

I suspect that the issue here is that the shortcodes may not have been registered for use as view parameters.

Go to Toolset -> Settings -> Frontend and enter the names of your shortcode under the view 3rd party shortcode arguments section.

Please try this and let me know if the view works fine after.

Thanks,
Shane

#536262

Shane -

Nailed it! I just missed that step (wherever it may be in the docs). Works like charm.

I'm glad it turned out to be so simple.

- Peter

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