How to use shortcode in a template

Below you can see my home page template. I used to have this line in the content of my page, it loads the thumbnail and the video player with video. I now want to have this in a template but i dont know how to call it properly. You can see I am trying to call the video from my theme options panel.

Before

Read More
[KGVID poster="http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg" width="1005" height="565"]http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/sample.mp4[/KGVID]

After

[KGVID poster="http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg" width="1005" height="565"]http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/sample.mp4[/KGVID]

Any help would be much appreciated.

<?php /* Template Name: Home Page */ get_header(); ?>

    <!-- section -->
    <section role="main">

    <?php if (have_posts()): while (have_posts()) : the_post(); ?>

        <!-- article -->
        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

            [KGVID poster="http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg" width="1005" height="565"]<?php echo $smof_data['home-page-video-url'];?>[/KGVID]

        </article>
        <!-- /article -->

    <?php endwhile; ?>

    <?php else: ?>

        <!-- article -->
        <article>

            <h2><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h2>

        </article>
        <!-- /article -->

    <?php endif; ?>

    </section>
    <!-- /section -->

<?php get_footer(); ?>

Related posts

Leave a Reply

1 comment

  1. For using shortcode in templates do this

    <?php echo do_shortcode("[KGVID poster='http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/thumbnail-home.jpg' width='1005"' height='565']http://www.muratgokmen.co.uk/wp-content/uploads/2013/09/sample.mp4[/KGVID]"); ?>