I am not sure if there is a simple solution to my problem. The requirement looks simple but unable to find answer even after breaking my head for 6 hours.
I have to pass variable from a php function to a shortcode and this shortcode has to pass on the this variable to another shortcode. Shortcode-1 will open a popup and the content of the popup is created by shortcode-2, content has to be changed based on the variable. How can I acheive this?
Code in my template..
<a href="#" class="open-popup-1" variable= <?php getid(); ?>"> <?php echo "Click here"?> </a>
popup shortcode:
[modifycontent id=$variable]
My shortcode function
function modifycontent($atts = [], $content = null)
{
// do something to $content
$var = atts['id'];
$content = gettherightcontent($var);
return $content;
}
add_shortcode('mc', 'modifycontent');
I tried like this, I managed to call my shortcode but unable to pass the variable.