Title: Shortcode and HTML in template
Last modified: August 20, 2016

---

# Shortcode and HTML in template

 *  [fredcampagna](https://wordpress.org/support/users/fredcampagna/)
 * (@fredcampagna)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/shortcode-and-html-in-template/)
 * I would like to include the following shortcode/html sequence in a new page template.
   I have explored using do_shortcode, but can’t seem to format it properly so that
   it doesn’t return a server error. Any thoughts?
 * I have tried different variations of this and can’t get it to work.
 *     ```
       <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
       <?php echo do_shortcode('[tab name="7 Day Forecast"]'.<div id="widget-forecast"></div>.'[/tab]'); ?><?php echo do_shortcode('[tab name="Currents"]'.<div id="widget-currents"></div>.'[/tab]'); ?><?php echo do_shortcode('[/end_tabset]'); ?>
       ```
   

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

 *  [9ete](https://wordpress.org/support/users/hawkeye126/)
 * (@hawkeye126)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/shortcode-and-html-in-template/#post-3484847)
 * After looking at:
    [http://codex.wordpress.org/Function_Reference/do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode)
 * Put the text in a variable that will be wrapped by the short code may be the 
   appropriate way to handle the situation:
 *     ```
       <?php
       the_content('<p class="serif">Read the rest of this page »</p>');
       ?>
       <?php
       $shortcode_text = "<div id='widget-forecast'></div>";
       echo do_shortcode('[tab name="7 Day Forecast"]'.$shortcode_text.'[/tab]');
       ?>
       <?php
       $shortcode_text = "<div id='widget-currents'></div>";
       echo do_shortcode('[tab name="Currents"]'.$shortcode_text.'[/tab]');
       ?><?php
       echo do_shortcode('[/end_tabset]');
       ?>
       ```
   
 * Hope that helps.
 *  Thread Starter [fredcampagna](https://wordpress.org/support/users/fredcampagna/)
 * (@fredcampagna)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/shortcode-and-html-in-template/#post-3484850)
 * Thanks for your input. Unfortunately, when I use that code, the only thing that
   gets outputted in the page is `[/end_tabset]` as plain text. I was experiencing
   that with other variations, too. Is it something to do with the plugin?
 * [http://www.eastbayri.com/weather/](http://www.eastbayri.com/weather/)
 *  [9ete](https://wordpress.org/support/users/hawkeye126/)
 * (@hawkeye126)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/shortcode-and-html-in-template/#post-3484869)
 * What plugin are you using? I have not used that shortcode before so I don’t believe
   I’m familiar with the plugin. Off the top of my head are you possibly missing
   the opening tag to [/end_tabset]? Would adding:
 *     ```
       <?php
       echo do_shortcode('[tabset]');
       ?>
       ```
   
 * to the beginning help?

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

The topic ‘Shortcode and HTML in template’ is closed to new replies.

## Tags

 * [html](https://wordpress.org/support/topic-tag/html/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * 3 replies
 * 2 participants
 * Last reply from: [9ete](https://wordpress.org/support/users/hawkeye126/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/shortcode-and-html-in-template/#post-3484869)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
