Skip Navigation

[Resolved] Use of custom function as a views shortcode attribute

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

Problem:
The issue here is that the user wanted to add a custom shortcode as an attribute to his views shortcode parameter like this.

[wpv-view name="liste-der-vorstandsfunktionen-im-aktuellen-clubjahr-neu" wpvccy="[currentclubyear]"]

Solution:
This is possible, however since it is a custom shortcode you will need to add it to the views third party shortcode arguments.
To do this you will need to go to Toolset -> Settings -> Frontend Content and then add your shortcode name to the Views 3rd party shortcode arguments.

Once you have done this then it shoulda start working,

This support ticket is created 7 years 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 Matthias Reichl 7 years ago.

Assisted by: Shane.

Author
Posts
#594386
taxonomy filter.png

I am trying to:

Use a custom function within a views shortcode attribute
I use a taxonomy filter als per attached screenshot
I followed the recommendations in: https://toolset.com/forums/topic/controlling-the-filter-with-shortcode-attributes-current-url/

I call the view within the page with the following code:

Value of function currentclubyear = [currentclubyear]

USE OF FUNCTION IN SHORTCODE

[wpv-view name="liste-der-vorstandsfunktionen-im-aktuellen-clubjahr-neu" wpvccy="[currentclubyear]"]

USE OF VALUE IN SHORTCODE

[wpv-view name="liste-der-vorstandsfunktionen-im-aktuellen-clubjahr-neu" wpvccy="2017/18"]

Link to a page where the issue can be seen:
hidden link

I expected to see:
The views output

Instead, I got:
„]

#594487

Shane
Supporter

Languages: English (English )

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

Hi Rainer,

Thank you for contacting our support forum.

Yes this is possible but first you must enable views to process the shortcode. To do this you will need to go to Toolset -> Settings -> Frontend Content and then add your shortcode name to the Views 3rd party shortcode arguments.

Once you have done this then it shoulda start working,

Thanks,
Shane

#594782

Hi Shane!

How could I forget this 😉

Thanks for the hint, it's solved.