I’m trying to nest a shortcode within [ESPRESSO_CART_LINK event_id=”[SHOW_EVENT_ID]-312″ anchor=”Add to Cart”] to automatically select the current record event_ID. The second value is a constant.
<code>//Returns event_id value for the current record.
//Best used nested with other shortcodes
//[SHOW_EVENT_ID]
function show_event_id_func( $atts ){
return $event_id;
}
add_shortcode('SHOW_EVENT_ID', 'show_event_id_func');</code>
Tried it a lot of ways (e.g., echo, enclosed in <?php ?>. I think I’m calling the wrong value since it doesn’t work as a standalone either.
You’ll need to define your $event_id variable in your custom function, or use your cart shortcode in a do_shortcode and use $event_id within the loop ($event_id is already defined for the loop in registration_page.php).
Viewing 2 reply threads
The support post ‘Nesting Shortcode for Event ID’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.