Output a shortcode inside an echo for wordpress

I am trying to write a shortcode that has another shortcode nested inside of it. The [map id=”1″] shortcode is being generated from a different plugin but I want to have the map display when I execute this shortcode.

I don’t think this is the best way to go about this but I am still new to php coding.

<?php
add_shortcode( 'single-location-info', 'single_location_info_shortcode' );
    function single_location_info_shortcode(){
        return '<div class="single-location-info">
                    <div class="one-half first">
                        <h3>Header</h3>
                        <p>Copy..............</p>
                    </div>
                    <div class="one-half">
                        <h3>Header 2</h3>
                        <p>Copy 2............</p>
                        <?php do_shortcode( '[map id="1"]' ); ?>
                    </div>
                </div>';
                }
?>

I dont think I should be trying to call php from within a return…. I though I read somewhere that I should use a “heredoc” but I have been unable to get it to work correctly.

Any thoughs?

Thanks


Source: shortcode

Leave a Reply