WordPress Inquiry : Can't Parse custom tags in RSS item feed using SimplePie

245 views Asked by At

I modified my default rss feed items to include elemnts from custom fields. It now looks like this.

<item>
    <title>Post Title</title>
    <link>http://example.com/</link>
    <pubDate>Sun, 22 Apr 2018 16:35:09 +0000</pubDate>
     <dc:creator><![CDATA[lubandi]]></dc:creator>
        <category><![CDATA[Bobi Wine]]></category>

    <guid isPermaLink="false">http://example.com/</guid>
    <description><![CDATA[Source: AUDIO LAD]]></description>
<field>Custom field value here</field>
</item>

I have failed to figure out how to read the value for "field". I am using the default SimplePie to read all the other elements from the feed.

The SimplePie provides the function get_item_tags($namespace, $tag) , but i have tried and failed to get the value. This is the demo code from simple pie

$media_group = $item->get_item_tags('', 'group');
$media_content = $media_group[0]['child']['']['content'];
$file = $media_content[0]['attribs']['']['url'];
echo $file;

Any help will be greatly appreciated. Thank you.

EDIT: I modified the demo code like this for my situation but it is not working: It returns null

$media_group = $item->get_item_tags('', 'group');
$media_content = $media_group[0]['child']['']['field'];
$song_title = $media_content[0]['attribs']['']['field'];
echo $song_title;
0

There are 0 answers