user2413333
user2413333

Reputation: 1405

How to extract shortcode from shortcode with this format:

If you have a shortcode that is created like this:

[shortcode1 attribute1="content" attribute2="content with [shortcode2] too"]

because shortcode2 is being used this way, it is breaking shortcode1. How do I extract the attribute2 content and then execute the shortcode2?

Currently I am extracting the attributes like this:

extract( shortcode_atts( array( 'attribute1' => '', 'attribute2' => ''), $atts ) ); But having shortcode2 in an attribute breaks the output completely.

Anyone know how to do this? Thanks

Upvotes: 0

Views: 232

Answers (1)

M Khalid Junaid
M Khalid Junaid

Reputation: 64476

You need to call do_shortcode() for the content of attribute2 when returning from first shortcode function call

Like do_shortcode($atts['attribute2']);

How to Create Nested Shortcodes in WordPress

Upvotes: 0

Related Questions