Problem: I would like to use a PHP variable in a shortcode attribute.
Solution: You can't use PHP variables directly in your shortcode attributes. Instead, you could create a custom shortcode that returns the value of that variable, and place that shortcode instead of the variable in your attribute.
$working_memap_id = 'some-post-slug'; add_shortcode( 'global_memap_id', 'global_memap_id_func'); function global_memap_id_func($atts) { global $working_memap_id; return $working_memap_id; }
[cred form form="properformname" post="[global_memap_id]"]
Register the name of the shortcode in Toolset > Settings > Frontend content > 3rd party shortcode arguments.
Relevant Documentation: https://codex.wordpress.org/Shortcode_API
https://toolset.com/documentation/user-guides/shortcodes-within-shortcodes/
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 |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 2 replies, has 2 voices.
Last updated by 7 years, 1 month ago.
Assisted by: Christian Cox.