shortcode inside another shortcode

I wonder if is it possible to have a shortcode inside another one?

My scenario is this:

I create a shortcodes to display content into columns so I can manage the layout of the page more easily. Now the problem comes, when I try to use for sample nextgen gallery into one of those shortcodes. For some reason it just generates the shortcode as plain text.

Any idea why?

I will show you the code I’m using for the shortcode maybe it helps:

 // Column ShortCode Description
function column_scdescription($atts, $content="null") {
    return '<div class="description">' .$content . '</div> <!-- description ends here -->';
}
add_shortcode ("product-description", "column_scdescription");

Thanks in advance.

2 Answers
2

I usually apply the_content filters to $content to do this. I think you can aslo use do_shortcode($content);

// Column ShortCode Description
function column_scdescription($atts, $content="null") {
    return '<div class="description">' .apply_filters('the_content', $content) . '</div> <!-- description ends here -->';
}
add_shortcode ("product-description", "column_scdescription");

Read up on Nested Shortcodes in the codex.

Leave a Comment