WordPress.org

Ready to get started?Download WordPress

Forums

Display RSS content including author in sidebar (1 post)

  1. jfburroway
    Member
    Posted 5 years ago #

    I want to display a list of recent posts from another WordPress blog I have, using the other blog's RSS. I'd like the display to read:

    Post 1 Title, by Author 1.
    Post 2 Title, by Author 2.
    Post 3 Title, by Author 3. ... etc.

    How do you get the author from the RSS Feed?

    Here is what I'm trying to do:

    <h2><?php _e('Latest BTB Diaries'); ?></h2>
    <?php // Get RSS Feed(s)
    include_once(ABSPATH . WPINC . '/rss.php');
    $rss = fetch_rss('http://www.boxturtlebulletin.com/feed');
    $maxitems = 5;
    $items = array_slice($rss->items, 0, $maxitems);
    ?>
    
    <ul>
    <?php if (empty($items)) echo '<li>No items</li>';
    else
    foreach ( $items as $item ) : ?>
    <li><a href='<?php echo $item['link']; ?>'
    title='<?php echo $item['title']; ?>'><?php echo $item['title']; ?> by <?php echo $item['dc:Creator']; ?></a></li>
    <?php endforeach; ?>
    </ul>

    dc:Creator returns null, which leaves the "Author" blank. What am I doing wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags