Create a gist now

Instantly share code, notes, and snippets.

// Extend SimplePie to retrieve the embed data from a feed
// Load SimplePie
// Define the GameTrailers namespace
// Extend SimplePie_Item with our own class
class SimplePie_Item_Gametrailers extends SimplePie_Item
// Make sure we pass everything through
function __construct($feed, $data) {
parent::__construct($feed, $data);
// Use SimplePie_Item's API to get the embed code
function get_embed_id()
$data = $this->get_item_tags(SIMPLE_NAMESPACE_GAMETRAILERS, 'fileType');
return $data[0]['child']['']['embedcode'][0]['data'];
// ...
// Example of how to use.
$sp = new SimplePie();
foreach($sp->get_items() as $item) {
echo $item->get_title() . ' - ';
echo '<br />';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment