Nested Shortcodes
-
Hi!
I have another question for you guys. Is it possible to use Shortcake and nested shortcodes?
An example: right, now, I’m trying to create a shortcode that is a wrapper for another shortcode (Tablepress [table] shortcode). It’s a shortcode that wraps the [table] shortcode into a div with some custom classes.
So, I’m using
do_shortcode
inside the function that renders the shortcode. On the frontend, it works great, but at the backend we don’t get a visual representation of the shortcode, we just get the [table] shortcode string.We’re using this piece of code:
$html = '<div class="table-wrapper" id="'. $id .'" responsive="'. $responsive .'">'; $html .= do_shortcode( '[table id="'. $id .'" responsive="'. $responsive .'"]' ); $html .= '</div>'; return $html;
This is the expected behavior for nested shortcodes, or maybe something particular to Tablepress’
[table]
shortcode? Or am I doing something wrong?Thanks!
- The topic ‘Nested Shortcodes’ is closed to new replies.