Yahoo Pipes RSS Question
-
I’m using Yahoo Pipes to create some mashup RSS feeds, and then using fetch_rss to bring the Yahoo Pipe RSS into wordpress. I am able to easily show the post title, but I also want to show the post author. To show the title I’m using the following code:
echo wp_specialchars(substr($item2['title'],0,80)) . "...";
this works great. Yahoo pipes stores the author under dc.creator. How do I reference that in the RSS feed. I’ve tried this, but it doesn’t work.
echo wp_specialchars($item2['dc']['creator']);
Thoughts
The full code looks this, and it was created by the nice people at devlougne.
<?php require_once (ABSPATH . WPINC . '/rss-functions.php'); // insert the feed URL here // insert the feed URL here $rss2 = @fetch_rss('https://pipes.yahoo.com/pipes/pipe.run?_id=b5163d43fb4b70e424ee593c29b01ea0&_render=rss'); if ( isset($rss2->items) && 0 != count($rss2->items) ) { ?> <?php // set the number of items from the feed to display (10) $rss2->items = array_slice($rss2->items, 0, 10); foreach ($rss2->items as $item2 ) { ?> <ul> <li> <a href='<?php echo wp_filter_kses($item2['link']); ?>'> <?php if (strlen($item2['title']) > 80) echo wp_specialchars(substr($item2['title'],0,80)) . "..."; else echo wp_specialchars($item2['title']); ?> <br /> <span class="cfroundmoreinfo"><?php echo wp_specialchars($item2['dc']['creator']); ?></span></a></li> </ul> <?php } ?> <?php } ?>
- The topic ‘Yahoo Pipes RSS Question’ is closed to new replies.