View Single Post
Old 03-16-2013, 10:40 AM  
Manfap
Confirmed User
 
Manfap's Avatar
 
Industry Role:
Join Date: Jan 2013
Posts: 2,624
PHP and wp custom fields ahhhhhhhhhhhhhh help

I´m fucking about in wp with custom fields calling the video url for the flowplayer plugin and I´m getting Parse error: syntax error, unexpected T_STRING on.....

Code:
<?php
 flowplayer('[flowplayer src=<?php echo get_post_meta($post->ID, '_wpb_video', true); ?>]');
 ?>
but
Code:
<?php flowplayer('[flowplayer src=/videos/example.flv]'); ?>
works

so I assumed its because I´m calling php again on the echo..
I tried
Code:
<?php flowplayer('[flowplayer src=echo get_post_meta($post->ID, '_wpb_video', true)]'); ?>
but get Parse error: syntax error, unexpected T_STRING on..... again

it´s not pulling the echo so I tried $string

This doesn´t break anything I actually get the page but it pulls echo as the filename
Code:
<?php
$string= " <?php echo get_post_meta($post->ID, '_wpb_video', true); ?> ";

 flowplayer('[flowplayer src=echo $string;]'); ?>
so I tried
Code:
 <?php
$string= "flowplayer('[flowplayer src=";
$string .="echo get_post_meta($post->ID, '_wpb_video', true)";
$string .="]')";
echo $string;
 ?>

which gives me
Code:
flowplayer('[flowplayer src=echo get_post_meta(142, '_wpb_video', true)]')
which seems to work codewise, but its posting it as text with "" surrounding it, rather than php.

so do I need to include <?php and ?> in the string? and it so how?
or how do make it so it s doesnt post the code within ""

if I do something like
Code:
 <?php
$string= "<?php flowplayer('[flowplayer src=";
$string .="echo get_post_meta($post->ID, '_wpb_video', true)";
$string .="]')" ?>;
echo $string;
 ?>
it doesnt complete the code due to the first ?>;

But because of my limited php knowledge thats me stuck.. anyone got any ideas.

Last edited by Manfap; 03-16-2013 at 10:43 AM..
Manfap is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote