WordPress.org

Ready to get started?Download WordPress

Forums

Shortcodes Pro
Nesting the shortcodes doesn't work (15 posts)

  1. helms
    Member
    Posted 1 year ago #

    It just outputs the nested shortcode in the html

    help?

    http://wordpress.org/extend/plugins/shortcodes-pro/

  2. redpupmedia
    Member
    Posted 1 year ago #

    Seconded. Nesting does not work.

  3. helms
    Member
    Posted 1 year ago #

    @Matt - can we get some help here please?

    Thanks in advance.

  4. helms
    Member
    Posted 1 year ago #

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

  5. redpupmedia
    Member
    Posted 1 year ago #

    no luck nesting so I abandoned this plugin and am using http://wordpress.org/extend/plugins/shortcoder/
    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.

  6. cmccrone
    Member
    Posted 1 year ago #

    Same Problem :(

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

  7. UaMV
    Member
    Posted 1 year ago #

    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]
    [/do1]
    [do]

    Reference for nested shortcodes

  8. Arley McBlain
    Member
    Posted 1 year ago #

    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!

  9. helms
    Member
    Posted 1 year ago #

    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.

  10. UaMV
    Member
    Posted 1 year ago #

    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():

    [tag-a]
       [tab-b]
          [tag-c]
       [/tag-b]
    [/tag-a]

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

    [tag-a]
       [tag-a]
       [/tag-a]
    [/tag-a]

    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.

  11. helms
    Member
    Posted 1 year ago #

    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]

  12. UaMV
    Member
    Posted 1 year ago #

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

  13. UaMV
    Member
    Posted 1 year ago #

    Maybe ... ? i'll think on it.

  14. thirddoor
    Member
    Posted 1 year ago #

    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.

  15. Arley McBlain
    Member
    Posted 9 months ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic