Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nesting shortcodes #2

Open
timsayshey opened this issue Oct 3, 2014 · 6 comments
Open

Nesting shortcodes #2

timsayshey opened this issue Oct 3, 2014 · 6 comments

Comments

@timsayshey
Copy link

I know this isn't available yet but I have a usecase.

[bootstrap type="row"]
[bootstrap type="col" width="6" size="md"] My First Column! [/bootstrap]
[bootstrap type="col" width="6" size="md"] My Second Column! [/bootstrap]
[/bootstrap]

Is nesting a possible future enhancement or is it impossible?

@neokoenig
Copy link
Owner

it's highly possible. If you look at the original implementation, that's what Barney does - I just didn't have the time to implement it. it involves recalling the shortcode function from within the shortcode.

@timsayshey
Copy link
Author

Tried my hand at it today but was unable to get it working.

However I did find a shortcodes cfc that handles nesting.

It might help you get it working:
http://www.barneyb.com/barneyblog/2010/03/13/wordpress-shortcodes-in-cfml/

@neokoenig
Copy link
Owner

That's what I based it off in the first place!! ;)

On 28 Aug 2015, at 17:16, Tim Badolato [email protected] wrote:

Tried my hand at it today but was unable to get it working.

However I did find a shortcodes cfc that handles nesting.

It might help you get it working:
http://www.barneyb.com/barneyblog/2010/03/13/wordpress-shortcodes-in-cfml/


Reply to this email directly or view it on GitHub.

@timsayshey
Copy link
Author

Lol, oh man...

I just reimplemented the whole plugin using his code, apparently even though he has tests for nested tags, they don't actually parse nested content. Well, switching back to yours since the code is way prettier :)

Okay, so I figured out a work around for now, calling processShortcodes(content) inside the shortcode.

Also, you can't nest the same shortcode, ie [bootstrap type="row"] [bootstrap type="col"] test [/bootstrap][/bootstrap] because it doesn't parse it right. But you can nest two different shortcodes, ie[bootstrap type="row"] [bootgrid col="12"] test [/bootgrid] [/bootstrap]

@neokoenig
Copy link
Owner

:) Yeah, I do the process shortcodes inside the shortcode thing. Works ok for simple stuff!

On 28 Aug 2015, at 17:54, Tim Badolato [email protected] wrote:

Lol, oh man...

I just reimplemented the whole plugin using his code, apparently even though he has tests for nested tags, they don't actually parse nested content. Well, switching back to yours since the code is way prettier :)

Okay, so I figured out a work around for now, calling processShortcodes(content) inside the shortcode.

Also, you can't nest the same shortcode, ie [bootstrap type="row"] [bootstrap type="col"] test [/bootstrap][/bootstrap] because it doesn't parse it right. But you can nest two different shortcodes, ie[bootstrap type="row"] [bootgrid col="12"] test [/bootgrid] [/bootstrap]


Reply to this email directly or view it on GitHub #2 (comment).

@neokoenig
Copy link
Owner

PS, if you’re implementing Bootstrap grids, you really do need to check out gridmanager.js :P [shameless plug]

On 28 Aug 2015, at 17:54, Tim Badolato [email protected] wrote:

Lol, oh man...

I just reimplemented the whole plugin using his code, apparently even though he has tests for nested tags, they don't actually parse nested content. Well, switching back to yours since the code is way prettier :)

Okay, so I figured out a work around for now, calling processShortcodes(content) inside the shortcode.

Also, you can't nest the same shortcode, ie [bootstrap type="row"] [bootstrap type="col"] test [/bootstrap][/bootstrap] because it doesn't parse it right. But you can nest two different shortcodes, ie[bootstrap type="row"] [bootgrid col="12"] test [/bootgrid] [/bootstrap]


Reply to this email directly or view it on GitHub #2 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants