Title: [Plugin: Shortcodes Pro] Shortcode Inside of the Shortcode
Last modified: August 20, 2016

---

# [Plugin: Shortcodes Pro] Shortcode Inside of the Shortcode

 *  Resolved [Jason](https://wordpress.org/support/users/ijas0n/)
 * (@ijas0n)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-shortcodes-pro-shortcode-inside-of-the-shortcode/)
 * Love this plugin! I have a problem with adding shortcode inside of shortcode.
 * For example, I’m using a shortcode like this:
 * [do action=”myaction”]
 * My Content
 * [gravityform id=”1″ name=”My Gravity Form Shortcode” title=”false” description
   =”false” ajax=”true”]
 * [/do]
 * The Shortcode [do action…] works however the Gravity Form shortcode in the middle
   does not and is shown as text. Any ideas on how I can get the shortcode inside
   the [do action…] shortcode to work?
 * I found something at this site: [http://stackoverflow.com/questions/4773186/shortcodes-inside-a-shortcode-wordpress](http://stackoverflow.com/questions/4773186/shortcodes-inside-a-shortcode-wordpress)
 * But I don’t’ quite understand it or how I could apply it and implement it into
   this scenario. Any help would be great.
 * [http://wordpress.org/extend/plugins/shortcodes-pro/](http://wordpress.org/extend/plugins/shortcodes-pro/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Matt](https://wordpress.org/support/users/sksmatt/)
 * (@sksmatt)
 * [14 years ago](https://wordpress.org/support/topic/plugin-shortcodes-pro-shortcode-inside-of-the-shortcode/#post-2623812)
 * Hi iJas0n,
 * I would suggest creating only one shortcode and process the Gravity Form inside.
   You can return the results of do_shortcode();.
 * Kind Regards!
 *  [GabLeRoux](https://wordpress.org/support/users/gableroux/)
 * (@gableroux)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-shortcodes-pro-shortcode-inside-of-the-shortcode/#post-2623820)
 * I use this plugin alot for interface and this is also something I’d like to do
   natively. After trying some tricks, I found a way to accomplish this.
 * This code doesn’t work:
 *     ```
       [do action="nine_six_zero_gs" grid="6" appearence="none"]<p><strong>Lorem Ipsum</strong> is simply dummy text of the printing.</p>
       [do action="button" color="black" url="http://www.google.ca/" target="_blank" size="medium" align="right"]Hire us![/do][/do]
       ```
   
 * Because it stats doing the shortcode “do” inside the other one but breaks at 
   the fist “[/do]” leaving the last [/do] written as text in the content (sadface).
 * But this one does!:
 *     ```
       [do action="nine_six_zero_gs" grid="6" appearence="none"]<p><strong>Lorem Ipsum</strong> is simply dummy text of the printing.</p>
       [do action="button" color="black" url="http://www.google.ca/" target="_blank" size="medium" align="right" content="Hire us!"/][/do]
       ```
   
 * 1st, I added do_shortcode to the content of `action="nine_six_zero_gs"`
    See 
   the code below:
 * > return ‘<div class=”grid_’ . $atts[“grid”] . ‘ ‘ . $atts[“appearence”] . ‘”
   > >’ . do_shortcode($content) . ‘</div>’;
 * And here’s the little tweak: my php code for the `action="button"` starts with
   this:
 * > if ($content == ”)
   >  $content = $atts[“content”];
 * So everything works fine!
 * In your case iJas0n, to be more clear, yout code:
 * > [do action=”myaction”]
   > My Content
   > [gravityform id=”1″ name=”My Gravity Form Shortcode” title=”false” description
   > =”false” ajax=”true”][/gravityform]
   > [/do]
 * could work fine just by adding **do_shortcode($content)** to the php code of 
   your “myaction” shortcode:
 * > return ‘some html or php before ‘ . do_shortcode($content) . ‘ some html or
   > php after’;
 * I Hope it helps someone out there.
 * Ps.
    Note to the dev: There should be an option allowing **recursivity** of do_shortcode()
   so it would be a bit easier than tweeking all of the shortcode made in this plugin:).
 * By the way, this plugin is awesome :D.
 *  Thread Starter [Jason](https://wordpress.org/support/users/ijas0n/)
 * (@ijas0n)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-shortcodes-pro-shortcode-inside-of-the-shortcode/#post-2623851)
 * Awesome! Thanks GabLeRoux! That worked like a charm.
 * For those others out there just to clarify:
 * 1) Create shortcode with whatever code you want. Add code to your page:
 * [do action=”myshortcode”] My Content [/do]
 * 2) Then to add other shortcode inside this shortcode, return to create shortcode,
   but use this instead:
 * `return ' ' . do_shortcode('[other shortcode here]') . ' ';`
 * 3) Then add the new shortcode in inside the other shortcode, making sure it only
   have one closing [/do]. So it would now look like this:
 * [do action=”myshortcode”] My Content [do action=”my2ndshortcode”/] [/do]
 * Thanks again for your help!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Shortcodes Pro] Shortcode Inside of the Shortcode’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shortcodes-pro_434343.svg)
 * [Shortcodes Pro](https://wordpress.org/plugins/shortcodes-pro/)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-pro/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Jason](https://wordpress.org/support/users/ijas0n/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-shortcodes-pro-shortcode-inside-of-the-shortcode/#post-2623851)
 * Status: resolved