WordPress.org

Support

Support » How-To and Troubleshooting » Function Reference/fetch rss

Function Reference/fetch rss

  • I am using the following Function Reference/fetch rss found in the codex. It works fine, right out of the box. I would like to limit the amount of entries it displays, does anybody know how to do that?

    <?php require_once(ABSPATH . WPINC . '/rss.php'); ?>
    <?php $rss = fetch_rss('http://example.com/rss/feed/goes/here'); ?>
    <ul>
    <?php foreach ( $rss->items as $item ) : ?>
    <li><a href='<?php echo $item['link']; ?>'
    title='<?php echo $item['title']; ?>'>
    <?php echo $item['title']; ?>
    </a></li>
    <?php endforeach; ?>
    </ul>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Yup 🙂

    It actually does this on your Dashboard’s index.php file. If you’re running 2.1, take a look at wp-admin/index-extra.php. Line #32’s array_slice function is probably what you’re looking for.

    Hope this helps,
    -drmike

    I think I am missing something. I tried some variations of that I cannot get anything to work.

    I just want to display the five latest posts from one wp blog on the main page of another wp blog. I have my above code working, but it is spitting out 30+ posts.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Function Reference/fetch rss’ is closed to new replies.