Skip Navigation

[Resolved] View query filter from shortcode attribute

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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 1 year ago.

Assisted by: Waqar.

Author
Posts
#2680510

In the wpv-view shortcode it is possible to enter a custom attribute like this: [wpv-view name='my-view' my-attribute='my-attribute-value'] Then you can control the views filter using arguments, which is described here: https://toolset.com/documentation/legacy-features/views-plugin/passing-arguments-to-views/#accessing-the-arguments
This is a great feature!!! My question is: How can we do this with the (new) Gutenberg block editor interface? There is no option to enter an attribute to the view. That's why we enabled the legacy interface and created the view that way. Then we inserted the wpv-view shortcode to the gutenberg block editor. It works, but is there a way to do this directly within the gutenberg block interface?

#2680551

Hi,

Your observation is correct and currently, it is not possible to pass a shortcode attribute to a view through the 'View' block in the Gutenberg editor.

However, you don't necessarily have to create the view using the legacy editor, to use this feature. You can create a view using the 'View' block in Gutenberg and when you have to load or call it in a page or content template, you can use the view's shortcode ( e.g. [wpv-view name='my-view' my-attribute='my-attribute-value'] ) instead of the view block.

regards,
Waqar

#2680584

Hi Waqar, thank you for your quick reply and your tip. My issue is resolved.