简体   繁体   中英

Putting a wordpress shortcode inbetween another wordpress shortcode

Essentially I want to use a short code at some predetermined point in another short code. My original Shortcode is grabbing a big chunk of text and I want to stick the next shortcode in at some point for a pull quote.

The only way I can think of is to use javascript to parse the original shortcode on page load for a certain character and insert the shortcode after that.

Is this possible?

From the Codex on nesting shortcodes :

The shortcode parser correctly deals with nested shortcode macros, provided their handler functions support it by recursively calling do_shortcode() :

[tag-a]
   [tag-b]
      [tag-c]
   [/tag-b]
[/tag-a]

However the parser will fail if a shortcode macro is used to enclose another macro of the same name:

[tag-a]
   [tag-a]
      [tag-c]
   [/tag-a]
[/tag-a]

Long story short: you can do this, as long as you follow the above rule.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM