0

I don't know if this is the correct way to approach this, but here it goes. I'm working on Visual Composer (but could be vanilla WP), and I'm trying to implement a shortcode which generates another bunch of shortcodes. Somewhat a template shortcode.

For example:

[test title="some title"]

Could be converted to:

[another_shortcode]
    [title]some title[/title]
    [get_posts total="5"]
[/another_shortcode]

Which will be further processed until the HTML is generated.

The thing that I'm trying to achieve is to tell the user to use some shortcodes which will generate a concrete Visual Composer shortcodes. This way I'm abstracting away the layout and if there are lot's of pages with a given layout they can be changed changing the shortcode.

Does make any sense? Is it doable?

0

Using do_shortcode within a shortcode does the trick of parsing the inner shortcodes. More information here: https://developer.wordpress.org/reference/functions/do_shortcode/

| improve this answer | |
-1

Use do shortcode:

<?php echo do_shortcode('[yourshortcode]'); ?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.