GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP and wp custom fields ahhhhhhhhhhhhhh help (https://gfy.com/showthread.php?t=1103302)

Manfap 03-16-2013 10:40 AM

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.

Naughty 03-16-2013 10:45 AM

Code:

flowplayer('[flowplayer src=<?php echo get_post_meta($post->ID, \'_wpb_video\', true); ?>]');
?

EddyTheDog 03-16-2013 10:51 AM

Quote:

Originally Posted by Naughty (Post 19531193)
Code:

flowplayer('[flowplayer src=<?php echo get_post_meta($post->ID, \'_wpb_video\', true); ?>]');
?

Its quotes - but not those ones - Maybe I can do it in the morning...

Naughty 03-16-2013 10:59 AM

Did you actually echo the function??

Manfap 03-16-2013 11:16 AM

wow that was quick.. thx for the replies.
Quote:

Originally Posted by Naughty (Post 19531218)
Did you actually echo the function??

The flowplayer is pulled as
Code:

<?php flowplayer('[flowplayer src=videos/example.flv]'); ?>
which is how they tell you to on their site
foliovision. com/seo-tools/wordpress/plugins/fv-wordpress-flowplayer

and works, it´s when I start messing with the content, switching it to pulling from a custom field it all goes pear-shaped and that is getting pulled on an echo.
Code:

<?php flowplayer('[flowplayer src=<?php echo get_post_meta($post->ID, '_wpb_video', true); ?>]'); ?>
or did you mean something else?

I tried
Code:

]<?php flowplayer('[flowplayer src=<?php echo get_post_meta($post->ID, \'_wpb_video\', true); ?>]'); ?>
the player parses now but pulls the vid url as sitename.com/<?php

Quote:

Originally Posted by EddyTheDog (Post 19531202)
Its quotes - but not those ones - Maybe I can do it in the morning...

thx.

hulker 03-16-2013 11:27 AM

Something like this should work php wise :



<?php
$postMeta = get_post_meta($post->ID, '_wpb_video', true);
?>

flowplayer('[flowplayer src=<?php echo $postMeta ?>]');

Colmike9 03-16-2013 11:31 AM

<?php
flowplayer('[flowplayer src=<?php echo get_post_meta($post->ID, '_wpb_video', true); ?>]');
?>

You're getting the parse error because you are trying to php echo inside an already open php call.. Try to concatenate the strings instead. :upsidedow

Manfap 03-16-2013 11:44 AM

Quote:

Originally Posted by hulker (Post 19531258)
Something like this should work php wise :



<?php
$postMeta = get_post_meta($post->ID, '_wpb_video', true);
?>

flowplayer('[flowplayer src=<?php echo $postMeta ?>]');

that returns the correct code



Code:

flowplayer('[flowplayer src=/2/2E/2EBBC2H3H0/8/0/7/1/c11708/fb43ba21e2/11708_01/01/11708_01_120sec_00.mp4]');
but as text if I php this flowplayer('[flowplayer src=<?php echo $postMeta ?>]'); it shows the player but doesnt pull the correct url for the vid it returns sitename.com/<?php... as the video


Quote:

Originally Posted by Colmike7 (Post 19531266)
<?php
flowplayer('[flowplayer src=<?php echo get_post_meta($post->ID, '_wpb_video', true); ?>]');
?>

You're getting the parse error because you are trying to php echo inside an already open php call.. Try to concatenate the strings instead. :upsidedow

Seems when I try and return the string I can get the code.. but then it doesnt treat the flowplayer as php it shows as text.



Serves me right for trying to be clever.. hehe.

Manfap 03-16-2013 01:02 PM

Solved it :GFYBand

Code:

<?php
        $vid = get_post_meta($post->ID, '_wpb_video', true);
        $splash = get_post_meta($post->ID, '_wpb_poster', true);
{ echo flowplayer( '[flowplayer src="' . $vid . '" width=580 height=326 splashend=show splash="' . $splash . '" autoplay=true]'); } ?>

Incase anyone ever needs to pull a vid from a custom field using flowplayer in wp.
this works.


All times are GMT -7. The time now is 03:35 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123