Title: Using shortcode in template file
Last modified: September 23, 2019

---

# Using shortcode in template file

 *  [ADigitalMark](https://wordpress.org/support/users/sypomark/)
 * (@sypomark)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/using-shortcode-in-template-file/)
 * Hi there,
 * Thanks for developing this simple to use, and lightweight plugin.
 * I have been using it successfully for a few weeks now on a client’s website while
   adding the shortcode via the admin. Now, however, there is a page that won’t 
   allow for the shortcode to be added this way. Instead, I need to add it via the
   page template file. However, adding the php below does not work.
 * `<?php echo do_shortcode('[random_content group_id="12"]'); ?>`
 * I am guessing that I am doing something wrong, but, I am afraid, I can’t work
   out what. In case it helps, the following does work fine:
 * `<?php echo do_shortcode('[logocarousel id="150"]'); ?>`
 * Any help you can offer would be most appreciated.
 * With kind regards,
 * Mark @ SYPO

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

 *  Plugin Author [Jeremy Green](https://wordpress.org/support/users/endocreative/)
 * (@endocreative)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/using-shortcode-in-template-file/#post-11976692)
 * Does the shortcode output anything when using do_shortcode, or is it simply blank?
 *  Thread Starter [ADigitalMark](https://wordpress.org/support/users/sypomark/)
 * (@sypomark)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/using-shortcode-in-template-file/#post-11981218)
 * Hi Jeremy,
 * Thanks for getting back to me.
 * When using do_shortcode in a php template file, it just outputs nothing at all.
 * With kind regards,
 * Mark
    -  This reply was modified 6 years, 8 months ago by [ADigitalMark](https://wordpress.org/support/users/sypomark/).

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

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

 * ![](https://ps.w.org/random-content/assets/icon-256x256.png?rev=3454855)
 * [Random Content](https://wordpress.org/plugins/random-content/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/random-content/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/random-content/)
 * [Active Topics](https://wordpress.org/support/plugin/random-content/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/random-content/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/random-content/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [ADigitalMark](https://wordpress.org/support/users/sypomark/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/using-shortcode-in-template-file/#post-11981218)
 * Status: not resolved