Hello,
Hoping someone is able to help.
I have some PHP embed code (see below) which I need to customize depending on page.
Therefore I’ve created a ACF text field and associated this to the page/post type I require.
I’ve managed to post content using ACF before but cannot figure out how to add text to a URL field.
Example: My field name is “elite_prospects_id” and I need to place this at the end of the URL.
<?
$rss = new SimpleXMLElement('http://eliteprospects.com/rss_player_stats2.php?player=$_elite_prospects_id’, null, true);
foreach($rss->xpath('channel/item') as $item)
{
echo utf8_decode($item->description);
}
?>
Would appreciate any help!
🙂
If the above code is inside a post loop then something like
$rss = new SimpleXMLElement('http://eliteprospects.com/rss_player_stats2.php?player='.get_field('_elite_prospects_id'), null, true);
If it’s not in a loop then you’ll need to supply the post_id the get_field() call.
Thank you John! 🙂 This was perfect and exactly what I needed!