Title: Use short code in template file
Last modified: August 30, 2016

---

# Use short code in template file

 *  [mtupuschies](https://wordpress.org/support/users/mtupuschies/)
 * (@mtupuschies)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/use-short-code-in-template-file/)
 * Hi I am trying to create a template file which is, at the end only visible to
   a given user role.
    Parts of my themes basic page template is:
 *     ```
       <div class='container'>
   
       				<main class='template-page content  <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper(array('context' => 'content','post_type'=>'page'));?>>
   
                           <?php
                           /* Run the loop to output the posts.
                           * If you want to overload this in a child theme then include a file
                           * called loop-page.php and that will be used instead.
                           */
   
                           $avia_config['size'] = avia_layout_class( 'main' , false) == 'entry_without_sidebar' ? '' : 'entry_with_sidebar';
                           get_template_part( 'includes/loop', 'page' );
                           ?>
   
       				<!--end content-->
       				</main>
   
       				<?php
   
       				//get the sidebar
       				$avia_config['currently_viewing'] = 'page';
       				get_sidebar();
   
       				?>
   
       			</div>
       ```
   
 *  I tried `<?php echo do_shortcode('[eyesonly]stuff[/eyesonly]'); ?>`
    But for
   some reason I cant find the right spot. Would be great if you can help.
 * Thanks in advance
 * [https://wordpress.org/plugins/eyes-only-user-access-shortcode/](https://wordpress.org/plugins/eyes-only-user-access-shortcode/)

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

 *  [theeohiostate](https://wordpress.org/support/users/theeohiostate/)
 * (@theeohiostate)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/use-short-code-in-template-file/#post-6295414)
 * i would like to be able to do the same , any idea ?
 *  [TamerDesigns](https://wordpress.org/support/users/dribgib/)
 * (@dribgib)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/use-short-code-in-template-file/#post-6295422)
 * I’m wondering about this as well
 *  Plugin Author [thomstark](https://wordpress.org/support/users/thomstark/)
 * (@thomstark)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/use-short-code-in-template-file/#post-6295423)
 * Shortcodes are processed inside the page content. Not outside. To control which
   roles can see which pages, use a plugin like WordPress Access Control.

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

The topic ‘Use short code in template file’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/eyes-only-user-access-shortcode_f1f0ef.
   svg)
 * [Eyes Only: User Access Shortcode](https://wordpress.org/plugins/eyes-only-user-access-shortcode/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/eyes-only-user-access-shortcode/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/eyes-only-user-access-shortcode/reviews/)

## Tags

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

 * 3 replies
 * 4 participants
 * Last reply from: [thomstark](https://wordpress.org/support/users/thomstark/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/use-short-code-in-template-file/#post-6295423)
 * Status: not resolved