How to echo shortcodes within shortcodes within shortcodes

I’m all tied up in knots trying to echo shortcodes within shortcodes and I really need your help please!

Here’s the code:

Read More
function custom_listify_single_job_listing_actions_after() {
global $post;

$url = get_post_meta( $post->ID, 'your_custom_meta_key', true );

echo '<a href="#my-popup" class="button popup-trigger">Contact me</a>';
echo '<div id="my-popup" class="popup"><?php echo do_shortcode('[groups_member group="Active Employer"]<?php echo do_shortcode('[widget id="jmfe_widget-7"]');?>[/groups_member]');?></div>'; 

}
add_filter( 'listify_single_job_listing_actions_after', 'custom_listify_single_job_listing_actions_after' );

The function adds a button to my site which opens a modal popup when clicked. I’m tying to display content within that popup that is restricted based on membership. That part uses the groups_member shortcode. Then, I’m trying to display content within the groups_member shortcode that belongs to a widget.

Each of the shortcodes works individually – the button, the popup, the restricted content and the widget shortcode – problem is that it doesn’t work when I try to put it all together. I’ve wondered about creating a shortcode that contains the other shortcodes and then somehow inserting that into the popup function, but I’m rubbish at this stuff as it turns out! Can you help please?

Related posts

1 comment

  1. I’m not to sure what you are after but echo with php, using string operators would give something like this, which is untested and may be missing a dot or a ‘ somewhere

      echo '<div id="my-popup" class="popup">'.do_shortcode('[groups_member group="Active Employer"]'.do_shortcode('[widget id="jmfe_widget-7"]').'[/groups_member]').'</div>';
    

Comments are closed.