Published on 11/23/2020
Published by amit
Explicitly setting Datatypes in Awesome
Since in WordPress anything in the shortcode is treated as a string value, we have provided the ability to explicitly set datatypes on variables within the Awesome Enterprise shortcodes. This is useful when we are doing data comparison
We support the following four types of datatype
- s: – this will cast the value to String
- n: – this will cast the value to Float
- i: – this will cast the value to Integer
- b: – this will cast the value to Bool
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[module.set lapp_id='5000' /] c.param=module.lapp_id will return '5000' c.param=s:{module.lapp_id} will return '5000' c.param=n:{module.lapp_id} will return 5000.00 c.param=i:{module.lapp_id} will return 5000 c.param=b:{module.lapp_id} will return true c.param=s:5 will return '5' c.param=s: will return '' c.param=n:5 will return 5.00 c.param=n: will return 0 c.param=i:5 will return 5.00 c.param=i:hello will return 0 c.param=b:5 will return true c.param=b:true will return true c.param=b:0 will return false c.param=b:false will return false c.param=b: will return false |