'Shortcode or PHP inside a shortcode in Wordpress

On a php page in wordpress, I have a shortcode for an accordion, that consists of the following, and works perfectly:

<?php echo do_shortcode('[su_accordion]
[su_spoiler title="Feature Locations" style="fancy"] CONTENT GOES HERE
[/su_spoiler]
[/su_accordion]'); ?>

Within the accordion, I want to display an interactive map, which can be displayed using either a shortcode, or PHP. Both options are:

[show-map id='1'], or
<?php build_i_world_map(1); ?>

When I insert either of these into the accordion shortcode, the map does not display. However, outside of the accordion, the second option above (with php) displays successfully.

What am I missing in terms of including this in the shortcode for the accordion?



Solution 1:[1]

In your example your outer section should be like

<?php echo do_shortcode('[su_accordion]
[su_spoiler title="Feature Locations" style="fancy"]'. build_i_world_map(1) .'
[/su_spoiler]
[/su_accordion]'); ?>

In wordpress you should call do_shortcode() for shortcode calls.

<?php echo do_shortcode("[show-map id='1']"); ?>

do_shortcode() reference

Solution 2:[2]

this is an effective way to include a concatenating inside a shortcode function

<?php echo do_shortcode('[download url='.$next_attachment_url.']'); ?>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Fernando