Title: Insert shortcode into template
Last modified: August 21, 2016

---

# Insert shortcode into template

 *  Resolved [pale2hall](https://wordpress.org/support/users/pale2hall/)
 * (@pale2hall)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/)
 * My question is the same as one that has already been [ asked, but never truely resolved](http://wordpress.org/support/topic/insert-short-code-into-theme-template?replies=4).
 * I would like to insert my banners in a location in my template that does not 
   use the fancy editor.
 * I did some research and found
    **`<?php echo do_shortcode("{adinserter Top}");?
   >`**
 * but it doesn’t seem to work with these shortcodes.
 * **tl;dr How can I use this plugin in the template’s source code?**
 * I know PHP, MySQL, HTML & CSS, but am still pretty new to wordpress.
 * Sincerely,
    Pale2Hall
 * [http://wordpress.org/plugins/ad-inserter/](http://wordpress.org/plugins/ad-inserter/)

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

 *  [wotto](https://wordpress.org/support/users/wotto/)
 * (@wotto)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4486853)
 * i’m running into the same issue. i’ve tried some hacks on the plugin by adding`
   add_action('get_header', 'ai_content_hook')` etc. but none of them worked. i 
   will update this thread if i figure anything out, but yeah i really like this
   plugin and i would really like to see it be able to work with template files.
   something like `<?php insert_ai_ad(1); ?>` would be great
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4487002)
 * [@pale2hall](https://wordpress.org/support/users/pale2hall/)
 * You insert {adinserter Top} into the post HTML code. Ad Inserter will replace
   this tag with the Top block code.
 * [@wotto](https://wordpress.org/support/users/wotto/)
 * If I understand correctly you would like to include spcific Ad Inserter block
   from the theme PHP files?
 *  Thread Starter [pale2hall](https://wordpress.org/support/users/pale2hall/)
 * (@pale2hall)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4487039)
 * [@spacetime](https://wordpress.org/support/users/spacetime/), I get that, but
   my goal is the same as wotto’s.
 * We would like to be able to place ads outside of posts and pages in out templates
   Headers and footers and places that arent normally editable without using the
   Theme Editor.
 *  [Dautic](https://wordpress.org/support/users/dautic/)
 * (@dautic)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4487060)
 * I want to display ads in the footer, then I add the shortcode `<?php echo do_shortcode("{
   adinserter Footer}"); ?>` In the footer.php file located in the theme folder,
   but these ads can not appear. why?
 * I’ve understood insert {adinserter Top} into the post HTML code, but I do not
   understand how to insert shortcode into a php file in the theme folder.
 * *Sorry if my english is bad, I hope you can understand.
 * Thanks
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4487061)
 * No, you can not use Ad Inserter plugin in PHP code.
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4487081)
 * Will consider implementing this functionality.
    Closing the thread.
 *  Plugin Author [Spacetime](https://wordpress.org/support/users/spacetime/)
 * (@spacetime)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4487120)
 * Please update to the latest version 1.3.4 which has option to insert code blocks
   via PHP function.

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

The topic ‘Insert shortcode into template’ is closed to new replies.

 * ![](https://ps.w.org/ad-inserter/assets/icon-256x256.jpg?rev=1502039)
 * [Ad Inserter - Ad Manager & AdSense Ads](https://wordpress.org/plugins/ad-inserter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ad-inserter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ad-inserter/)
 * [Active Topics](https://wordpress.org/support/plugin/ad-inserter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ad-inserter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ad-inserter/reviews/)

## Tags

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

 * 7 replies
 * 4 participants
 * Last reply from: [Spacetime](https://wordpress.org/support/users/spacetime/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/insert-shortcode-into-template/#post-4487120)
 * Status: resolved