Title: Use variable in template tag
Last modified: August 21, 2016

---

# Use variable in template tag

 *  Resolved [Dan Stramer](https://wordpress.org/support/users/danstramer/)
 * (@danstramer)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/use-variable-in-template-tag/)
 * Hi
    Is there an option to use a variable within a template tag? something like
   this: ` <?php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow("'
   $slideshow'", "width:718, height:356"); } ?>
 * The variable will be set from an advance custom field.
 * Thanks
    Dan
 * [http://wordpress.org/extend/plugins/meteor-slides/](http://wordpress.org/extend/plugins/meteor-slides/)

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

 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/use-variable-in-template-tag/#post-3911666)
 * Hi Dan, sure you can do this. Here’s an example that checks for a custom field
   called “slideshow_slug”, if the the post or page has a value for that custom 
   field it loads a slideshow with that slug:
 *     ```
       <?php // Load slideshow if post has a custom field for the slideshow slug
       if ( get_post_meta( $post->ID, "slideshow_slug", $single = true ) != "" ) {
       	$meteor_slug = get_post_meta( $post->ID, "slideshow_slug", $single = true );
       	if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow( $meteor_slug, "width:718, height:356" ); }
       } ?>
       ```
   
 * Notice that when you use a PHP variable you don’t need to use quotes around it
   in the meteor_slideshow function.
 *  Thread Starter [Dan Stramer](https://wordpress.org/support/users/danstramer/)
 * (@danstramer)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/use-variable-in-template-tag/#post-3911670)
 * Thanks Josh!
    I also got it working like so (I am using the afc plug in): ` <?
   php $slideshow = get_field('slideshow'); ?> <div class="slideshow-project"> <?
   php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow($slideshow,"
   width:718, height:356"); } ?>
 *  Plugin Author [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * (@jleuze)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/use-variable-in-template-tag/#post-3911742)
 * Good to hear you got it working Dan!

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

The topic ‘Use variable in template tag’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/meteor-slides_0f131a.svg)
 * [Meteor Slides](https://wordpress.org/plugins/meteor-slides/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/meteor-slides/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/meteor-slides/)
 * [Active Topics](https://wordpress.org/support/plugin/meteor-slides/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/meteor-slides/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/meteor-slides/reviews/)

## Tags

 * [ACF](https://wordpress.org/support/topic-tag/acf/)
 * [template tag](https://wordpress.org/support/topic-tag/template-tag/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)

 * 3 replies
 * 2 participants
 * Last reply from: [Josh Leuze](https://wordpress.org/support/users/jleuze/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/use-variable-in-template-tag/#post-3911742)
 * Status: resolved