Support » Plugin: Shortcodes Pro » Nesting the shortcodes doesn't work

Viewing 14 replies - 1 through 14 (of 14 total)
  • Seconded. Nesting does not work.

    @matt – can we get some help here please?

    Thanks in advance.



    has anyone been able to nest the shortcodes? i’ve followed the video, and it doesn’t work.



    no luck nesting so I abandoned this plugin and am using
    It’s not an exact match, but worked for my uses.

    I would like to see this plugin nest the shortcodes because of the integration with the WYSIWYG.

    Same Problem 🙁

    Other than this issues its a GREAT tool. Easy to use.

    A simple fix to allow for nesting shortcodes.

    In the file inc/class-shortcodespro-base.php, make the following two edits:

    Add to function _register_shortcode();

    for ( $i=1; $i<10; $i++ )
    { add_shortcode( 'do' . $i , array( &$this, 'do_shortcode' ) ); }

    Change final line in function do_shortcode( $atts = NULL, $content=”” ) from

    return $result;

    to this

    return do_shortcode( $result );

    Note that each nested shortcode will have to have a slightly different declaration:

    [do action=”my_shortcode”]
    [do1 action=”my_shortcode”]
    [do2 action=”my_other_shortcode”][/do2]

    Reference for nested shortcodes

    This didn’t exactly work for me, and isn’t maybe the best type of solution for the potentially green user.

    I hope this decent looking plugin gets fixed to support nested shortcodes soon!

    Worked for me. Although I don’t really like typing in 1 or 2, etc for each nested shortcode. Just wish Matt would fix this issue.

    i don’t think we can escape using the 1, 2 notation. According to WP Documentation linked above …

    The shortcode parser correctly deals with nested shortcode macros, provided their handler functions support it by recursively calling do_shortcode():


    However the parser will fail if a shortcode macro is used to enclose another macro of the same name:


    This is a limitation of the context-free regexp parser used by do_shortcode() – it is very fast but does not count levels of nesting, so it can’t match each opening tag with its correct closing tag in these cases.

    Thanks UaMV. Do you think you can change it so the shortcode declaration would take on the name of the shortcode created?

    for example:
    instead of [do action””]panel[do1 action=”” ]alert![/do1][/do]
    it would be [panel action””]panel[alert action””]alert![/alert][/panel]

    Yeah, that would be great! i’ll take a look at the code, but think we should be able to make it work.

    Maybe … ? i’ll think on it.

    It appears that the plugin code accounts for the nesting (lines 34-125 in inc > class-shortcodespro-base.php).

    No idea why it’s not working though.

    Could a fix be made to work from a theme’s functions.php? That would allow for the plugin to be updated.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Nesting the shortcodes doesn't work’ is closed to new replies.