Title: Include a template &amp; pass a variable.
Last modified: August 24, 2016

---

# Include a template & pass a variable.

 *  [drperil](https://wordpress.org/support/users/drperil/)
 * (@drperil)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/include-a-template-pass-a-variable/)
 * Hey all,
 * Love the plugin. I bought the custom short code addon because I thought it would
   let me just embed php (rather than an echo/return function).
 * My need is to include beers.php – a template file with a custom loop that grabs
   X posts – the variable.
 * I created the shortcode [beers] with the attribute ‘count’ and that seems to 
   go well.
 * The problem is that I can’t get it to process all the PHP, which includes calls
   to Advanced Custom Fields ( get_thefield($count); – that kind of thing).
 * Is there a way to use a PHP include and point to the beers.php or include the
   default template short code in the custom short code settings and pass it the
   variable?
 * Thoughts?
 * [https://wordpress.org/plugins/shortcodes-ultimate/](https://wordpress.org/plugins/shortcodes-ultimate/)

The topic ‘Include a template & pass a variable.’ is closed to new replies.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [Shortcodes Ultimate - Content Elements](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [drperil](https://wordpress.org/support/users/drperil/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/include-a-template-pass-a-variable/)
 * Status: not resolved