820 | | function wp_rss ($url, $num_items) { |
821 | | //ini_set("display_errors", false); uncomment to suppress php errors thrown if the feed is not returned. |
822 | | $rss = fetch_rss($url); |
823 | | if ( $rss ) { |
824 | | echo "<ul>"; |
825 | | $rss->items = array_slice($rss->items, 0, $num_items); |
826 | | foreach ($rss->items as $item ) { |
827 | | echo "<li>\n"; |
828 | | echo "<a href='$item[link]' title='$item[description]'>"; |
829 | | echo htmlentities($item['title']); |
830 | | echo "</a><br />\n"; |
831 | | echo "</li>\n"; |
832 | | } |
833 | | echo "</ul>"; |
| 820 | function wp_rss( $url, $num_items = -1 ) { |
| 821 | if ( $rss = fetch_rss( $url ) ) { |
| 822 | echo '<ul>'; |
| 823 | |
| 824 | if ( $num_items !== -1 ) { |
| 825 | $rss->items = array_slice( $rss->items, 0, $num_items ); |
| 826 | } |
| 827 | |
| 828 | foreach ( $rss->items as $item ) { |
| 829 | printf( |
| 830 | '<li><a href="%1$s" title="%2$s">%3$s</a></li>', |
| 831 | clean_url( $item['link'] ), |
| 832 | attribute_escape( strip_tags( $item['description'] ) ), |
| 833 | htmlentities( $item['title'] ) |
| 834 | ); |
| 835 | } |
| 836 | |
| 837 | echo '</ul>'; |
| 838 | } else { |
| 839 | _e( 'An error has occurred, which probably means the feed is down. Try again later.' ); |