2ne
2ne

Reputation: 5976

How to echo data within a page template

I am using short code to execute a video player in my page template but i also want to grab the URL from my custom theme options panel. This is the code I am trying and getting the error below. If i insert the video URL instead of my echo call then it works fine.

Any Help would be much appreciated.

<?php echo do_shortcode("[KGVID]<?php echo $smof_data['home-page-video-url'];?>[/KGVID]"); ?>

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/muratgok/public_html/wp-content/themes/default/page - home.php on line 11

Upvotes: 0

Views: 187

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

see for example here, do:

<?php echo do_shortcode("[KGVID]".$smof_data['home-page-video-url']."[/KGVID]"); ?>

yes you can do

<?php echo do_shortcode(
'[KGVID poster="muratgokmen.co.uk/wp-content/uploads/2013/09/…" width="1005" height="565"]'.$smof_data['home-page-video-url'].'[/KGVID]'
); ?>

Upvotes: 2

Related Questions