Skip Navigation

[Resolved] Using a custom shortcode parameter for conditional display as well as filter

This support ticket is created 7 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 3 replies, has 2 voices.

Last updated by neilR 7 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#581056

I have created a view with a custom shortcode parameter that applies a filter, so that I can use the same view for two different advert types [wpv-view name="advert-tabular" adtype="926"] or [wpv-view name="advert-tabular" adtype="925"].
I now wish to use the custom parameter adtype to adjust the view depending on whether it's 925 or 926.
e.g. [wpv-conditional if="( <<custom parameter adtype>>) eq '926' )"] My output [/wpv-conditional]
Is this possible?

#581059

I probably should explain a little further. Of course, within the loop I can access the individual post's ad type and check that, but I also wish to adjust elements outside the loop (in this case, column titles) - at this point, there is no ad to reference, so I think I need to reference the custom shortcode parameter somehow...

#581113

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Neil

The wpv-attribute shortcode is what you are looking for: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-attribute

It allows you to reference the shortcode attribute value from where you insert your View with the wpv-view shortcode.

If it's not clear how to use it or you run into problems, let me know.

#581155

Perfect, thank you 🙂