Title: Using WordPress Google Form Shortcode inside a Tab Shortcode
Last modified: August 21, 2016

---

# Using WordPress Google Form Shortcode inside a Tab Shortcode

 *  [calebrhastings](https://wordpress.org/support/users/calebrhastings/)
 * (@calebrhastings)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/)
 * Hello,
    I’m trying to use: [wpgform id=’119′]
 * Inside a [tab] shortcode like this:
    [tab title=”Eye Exam Voucher Request”] test[
   wpgform id=’119′] [/tab]
 * The form will work when in the body of the post. However, if I try to put it 
   in the Tab Shortcode it will not work.
 * Let me know what I’m missing.
    (I’m using the Photographer Theme by Organic Themes)
 * [http://wordpress.org/plugins/wpgform/](http://wordpress.org/plugins/wpgform/)

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

 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4079964)
 * Hmmm … I’m not sure how to answer this.
 * What defines the [tab] short code? Is it defined by a plugin on your theme? If
   it is a plusing, let me know and I can try it out. If it is in your theme, there
   isn’t much I can do as your theme is a commercial theme so I don’t have access
   to it.
 * If you [Google nested shortcodes](https://www.google.com/search?q=wordpress+nested+shortcodes&oq=wordpress+nested+shortco&aqs=chrome.1.69i57j0l3.6246j0&sourceid=chrome&ie=UTF-8)
   you’ll find lots of information about similar problems. From everything I scanned
   through, the responsibility for nesting correctly falls within the outer shortcode
   in your case, the [tab] shortcode.
 * There is some information [here on the Codex](http://codex.wordpress.org/Shortcode_API#Nested_Shortcodes).
 * I don’t think the issue you are having is one that WordPress Google Form can 
   fix. However, if it it turns out there is something I am doing wrong, I’d be 
   happy to look at it. Right now I am not even sure what I’d look for.
 *  Thread Starter [calebrhastings](https://wordpress.org/support/users/calebrhastings/)
 * (@calebrhastings)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4079995)
 * Looks like it’s part of the “shortcodes.php” file in my Theme.
 * The file is here:
    [http://cl.ly/code/1S0r082a0Y06](http://cl.ly/code/1S0r082a0Y06)
 * Thank you for taking a look at this!
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080077)
 * I think the problem is in the shortcode definition for **tab**.
 *     ```
       function organic_tab( $atts, $content ){
       	extract(shortcode_atts(array(
       		'title' => 'Tab %d'
       	), $atts));
   
       	$x = $GLOBALS['tab_count'];
       	$GLOBALS['tabs'][$x] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content );
   
       	$GLOBALS['tab_count']++;
       }
       add_shortcode( 'tab', 'organic_tab' );
       ```
   
 * Nowhere inside this function (which defines the **tab** shortcode) does it make
   another call to do_shortcode() which it should in order to process shortcodes
   embedded within shortcodes.
 * I think if you changed the function to the following it would work but without
   having the entire theme to test with I am not sure.
 *     ```
       function organic_tab( $atts, $content ){
       	extract(shortcode_atts(array(
       		'title' => 'Tab %d'
       	), $atts));
   
               do_shortcode( $content );
   
       	$x = $GLOBALS['tab_count'];
       	$GLOBALS['tabs'][$x] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content );
   
       	$GLOBALS['tab_count']++;
       }
       add_shortcode( 'tab', 'organic_tab' );
       ```
   
 *  Thread Starter [calebrhastings](https://wordpress.org/support/users/calebrhastings/)
 * (@calebrhastings)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080084)
 * Thank you for working hard to find a solution.
    I’ve tried that code. However
   it didn’t work. I added “echo do_shortcode ( $content );” where you added “do_shortcode(
   $content );”
 * It did run the embedded shortcode however it didn’t place the resulting form 
   inside the “tab” it placed it above the tab…
 * I’m wondering if the placement of the phrase:
    “echo do_shortcode ( $content );”
   in the correct place would help the results.
 * Thoughts?
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080085)
 * Duh – I see what I did wrong.
 * Try this:
 *     ```
       function organic_tab( $atts, $content ){
       	extract(shortcode_atts(array(
       		'title' => 'Tab %d'
       	), $atts));
   
               $content = do_shortcode( $content );
   
       	$x = $GLOBALS['tab_count'];
       	$GLOBALS['tabs'][$x] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content );
   
       	$GLOBALS['tab_count']++;
       }
       add_shortcode( 'tab', 'organic_tab' );
       ```
   
 * Because you used **echo** it placed the content into your page at the time it
   was called, not when the tab was constructed. Assigning the output of **do_shortcode()**
   to **$content** should result in it being the the correct place.
 *  Thread Starter [calebrhastings](https://wordpress.org/support/users/calebrhastings/)
 * (@calebrhastings)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080087)
 * Your support is amazing.
    I greatly appreciate your help. It did call for the[
   wpgform] shortcode and executed it. However, the resulting tab did not give enough
   vertical space to display the form. I can only see the first 2 lines of the form.
 * So I’m not sure what else describes the size of the tab <div>?
 * Again,
    thank you for all your help!
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080088)
 * Do you have it live where I can see it? The tab content is almost certainly contained
   in a DIV and hopefully the DIV has an ID and if it does, you can set the height
   using CSS!
 *  Thread Starter [calebrhastings](https://wordpress.org/support/users/calebrhastings/)
 * (@calebrhastings)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080089)
 * [http://lovinglearners.com/?page_id=144](http://lovinglearners.com/?page_id=144)
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080090)
 * Try adding something like this to your CSS file:
 *     ```
       #tabs-1 {
           height: 500px;
       }
       ```
   
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080091)
 * BTW – Firebug doesn’t like your site very much, it issues a lot of Javascript
   warnings when I look at it. May be something you want to look into.
 *  Thread Starter [calebrhastings](https://wordpress.org/support/users/calebrhastings/)
 * (@calebrhastings)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080105)
 * Thank you again! Appreciate all your help.
 *  Plugin Author [Mike Walsh](https://wordpress.org/support/users/mpwalsh8/)
 * (@mpwalsh8)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080106)
 * Doesn’t seem to have worked on the URL you posted above – did you do it on your
   live site or in your development area?
 *  Thread Starter [calebrhastings](https://wordpress.org/support/users/calebrhastings/)
 * (@calebrhastings)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080107)
 * No it hasn’t worked. I just can’t spend more time on it now, so I’ve just done
   this here:
    [http://lovinglearners.com/development/?p=95](http://lovinglearners.com/development/?p=95)
 * Put a link to the form pages in the tabs… works for now.
 *  [danteangeles](https://wordpress.org/support/users/danteangeles/)
 * (@danteangeles)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080183)
 * bro,
    try this plugin: squelch tabs and accordions [http://wordpress.org/plugins/squelch-tabs-and-accordions-shortcodes/](http://wordpress.org/plugins/squelch-tabs-and-accordions-shortcodes/)
 * your shortcode will work inside the tabs shortcode of squelch.

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

The topic ‘Using WordPress Google Form Shortcode inside a Tab Shortcode’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wpgform_8cc59f.svg)
 * [Google Forms](https://wordpress.org/plugins/wpgform/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpgform/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpgform/)
 * [Active Topics](https://wordpress.org/support/plugin/wpgform/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpgform/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpgform/reviews/)

 * 14 replies
 * 3 participants
 * Last reply from: [danteangeles](https://wordpress.org/support/users/danteangeles/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/using-wordpress-google-form-shortcode-inside-a-tab-shortcode/#post-4080183)
 * Status: not resolved