Title: Calling Shortcoder codes in post templates using PHP
Last modified: December 17, 2018

---

# Calling Shortcoder codes in post templates using PHP

 *  Resolved [craiggroshek](https://wordpress.org/support/users/craiggroshek/)
 * (@craiggroshek)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/calling-shortcoder-codes-in-post-templates-using-php/)
 * I cannot find any info on how to call the shortcodes created with Shortcoder 
   in PHP, for use in Post Templates. I’m looking to have one of our shortcodes 
   execute globally before content on ALL of our posts, retroactively, and rather
   than edit 1000+ posts and manually paste the shortcode into them all, it seems
   editing the post templates to include it always would be the better route to 
   go.
 * The trouble is, I cannot find any official resource on how to do it on any of
   the forums, yet.
 * Someone in the comments on this forum, not the develop discussed how “to call
   from WordPress PHP,” and said to wrap the below in PHP tags (as it wouldn’t allow
   her to do so in the comments). Can you speak to whether the below is accurate,
   or if there is a specific script which needs to be used to call the shortcodes
   in PHP/templates?
 * Thanks in advance for your help!
 * echo do_shortcode(“[sc name=’shortcoderName’]”);

Viewing 1 replies (of 1 total)

 *  Plugin Author [vaakash](https://wordpress.org/support/users/vaakash/)
 * (@vaakash)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/calling-shortcoder-codes-in-post-templates-using-php/#post-11003940)
 * Hi [@craiggroshek](https://wordpress.org/support/users/craiggroshek/), yes you
   are right. To execute any shortcode in template, you have to use do_shortcode.
   This is an official wordpress API so you can go ahead using it.
 * You can also refer links below.
 * [https://css-tricks.com/snippets/wordpress/shortcode-in-a-template/](https://css-tricks.com/snippets/wordpress/shortcode-in-a-template/)
 * [https://developer.wordpress.org/reference/functions/do_shortcode/](https://developer.wordpress.org/reference/functions/do_shortcode/)

Viewing 1 replies (of 1 total)

The topic ‘Calling Shortcoder codes in post templates using PHP’ is closed to new
replies.

 * ![](https://ps.w.org/shortcoder/assets/icon.svg?rev=2222236)
 * [Shortcoder — Create Shortcodes for Anything](https://wordpress.org/plugins/shortcoder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcoder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcoder/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcoder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcoder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcoder/reviews/)

## Tags

 * [page templates](https://wordpress.org/support/topic-tag/page-templates/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [templates](https://wordpress.org/support/topic-tag/templates/)

 * 1 reply
 * 2 participants
 * Last reply from: [vaakash](https://wordpress.org/support/users/vaakash/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/calling-shortcoder-codes-in-post-templates-using-php/#post-11003940)
 * Status: resolved