Function Reference/fetch rss (3 posts)

  1. Aaron
    Posted 9 years ago #

    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'); ?>
    <?php foreach ( $rss->items as $item ) : ?>
    <li><a href='<?php echo $item['link']; ?>'
    title='<?php echo $item['title']; ?>'>
    <?php echo $item['title']; ?>
    <?php endforeach; ?>
  2. drmike
    Posted 9 years ago #

    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,

  3. Aaron
    Posted 9 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.