Title: shortcode in template ?
Last modified: August 21, 2016

---

# shortcode in template ?

 *  [batorowicz](https://wordpress.org/support/users/batorowicz/)
 * (@batorowicz)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/shortcode-in-template-5/)
 * Hi,
 * I trying embed shortcode in my template:
 * `<?php echo do_shortcode('[wc_toggle title="test" layout="box"][/wc_toggle]')?
   >`
 * but it not working. on my page I see only:
 * [wc_toggle title=”test” layout=”box”][/wc_toggle]
 * Is there possible do that?
 * [https://wordpress.org/plugins/wc-shortcodes/](https://wordpress.org/plugins/wc-shortcodes/)

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

 *  [Nathan Hawkes](https://wordpress.org/support/users/natehawkes/)
 * (@natehawkes)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/shortcode-in-template-5/#post-4919322)
 * Just wondering, did you get anywhere with this? I’m having the exact same problem,
   only the other shortcodes I have tried from this plugin work perfectly in the
   same function. So `[wc_button type="primary" url="http://webplantmedia.com" title
   ="Visit Site" target="self" position="float"]Sample Content[/wc_button]` will
   work, but `[wc_toggle]` won’t, even if they’re both in the same `do_shortcode()`
   function.
 *  Thread Starter [batorowicz](https://wordpress.org/support/users/batorowicz/)
 * (@batorowicz)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/shortcode-in-template-5/#post-4919323)
 * No, unfortunately I didn’t.
 *  [Nathan Hawkes](https://wordpress.org/support/users/natehawkes/)
 * (@natehawkes)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/shortcode-in-template-5/#post-4919324)
 * I think I found a solution, a couple of days ago. I forgot I had posted on here,
   otherwise I would have shared this earlier.
 * My data that I want to appear (`[wc_toggle][/wc_toggle]`) is stored in a custom
   meta field, which is then brought into my template where needed. Instead of using`
   do_shortcode`, I found that `<?php echo apply_filters( 'the_content', get_post_meta(
   get_the_ID(), 'custom_field_name', true ) ); ?>` works. I think replacing the`
   get_post_meta` function with your own content would do the same job.

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

The topic ‘shortcode in template ?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wc-shortcodes_ffffff.svg)
 * [Shortcodes by Angie Makes](https://wordpress.org/plugins/wc-shortcodes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wc-shortcodes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wc-shortcodes/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-shortcodes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-shortcodes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-shortcodes/reviews/)

## Tags

 * [do_shortcode](https://wordpress.org/support/topic-tag/do_shortcode/)

 * 3 replies
 * 2 participants
 * Last reply from: [Nathan Hawkes](https://wordpress.org/support/users/natehawkes/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/shortcode-in-template-5/#post-4919324)
 * Status: not resolved