views:

282

answers:

1

Hi!

Wordpress 2.8.4, Simple Pie Plugin 2.2.1

I'm having this:

<?php echo SimplePieWP(array(
'http://gdata.youtube.com/feeds/base/videos?q=fifa10%20trailer&amp;client=ytapi-youtube-search&amp;alt=rss&amp;v=2'
),array('items' => '1')); ?>

Instead of "fifa10" I'd like to have the value of a custom field with the key "name-of-game" in there.

How can I do this? PHP newbie asking...

A: 

You get the value of a Wordpress custom field with get_post_meta():

get_post_meta($post->ID, 'name-of-game', true)

To include it in your function call to SimplePieWP, use string concatenation with . (dot):

<?php echo SimplePieWP(array('http://gdata.youtube.com/feeds/base/videos?q=' .
get_post_meta($post->ID, 'name-of-game', true) .
'%20trailer&client=ytapi-youtube-search&alt=rss&v=2'),array('items' => '1')); ?>
Florian Jenn