Skip Navigation

[Resolved] Can you add a variable into conditional output?

This support ticket is created 4 years, 2 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.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by StanleyT8485 4 years, 2 months ago.

Author
Posts
#1805129

Tell us what you are trying to do?
I want to add a variable into Toolset's conditional output.

[wpv-conditional if="( '[types field='gearing'][/types]' lte '20' )"]This is good![/wpv-conditional] 
[wpv-conditional if="( '[types field='gearing'][/types]' gte '50' )"]This is bad![/wpv-conditional]

Currently, I am hard coding the number "20" and "50" inside the conditional output across multiple Views.

I will be updating the number every few months and ideally, I want to avoid doing this for all the Views with this conditional output.

Any feedback or help will be much appreciated!

#1805513

Nigel
Supporter

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

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

You can use shortcodes on both sides of the condition (left and right of the comparison), so in principle yes, but I guess the question is where are you going to store these values of 20 and 50 that may later be changed?

If it doesn't make sense to store than as a custom field on some post or page (I don't know), you could register custom shortcodes to return each value and then you would just need to edit the code for those shortcodes each time you wanted to make changes.

#1805547

Thanks! I`ll figure the rest out.