Shortcodes into shortcode
-
I need an information if possible, because I don’t find anything arount about this situation.
I would like to run some shortcodes (or just one) called from another shortcode.
To do this I put this code under my child theme’s functions.php:
add_shortcode('format', 'shortcode_block_format'); function shortcode_block_format ( $atts ) { switch( $atts['which'] ) { case '1' : return do_shortcode('[my-old-shorcode]'); break; case '2' : etc etc } }
but when I write [format which =”1″] in the editor, and then I save the post, the result is just this written on the frontend page:
[my-old-shorcode]
So the new shortcode [format which =”1″] works because it makes the old shortcode [my-old-shorcode], but [my-old-shorcode] is no longer interpreted by wp, who “sees” it just like any other text.
The question is: there is a way to RUN a shortcode called from another one?
Thank you!!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Shortcodes into shortcode’ is closed to new replies.