Have you seen other bloggers who display their other blog’s feed on their site. You want to do it too for extra promotion and traffic. Well here is the tutorial for you. Simply paste the following code in anywhere in your theme:
There are times when you want to
display external RSS feed on your blog. Perhaps a blog feed of your another blog or some other site. Well you do not need a plugin to do this because WordPress have a function built in that will take care of this. In this article we will show you how you can display an external RSS feed on your blog. This way you can even use WordPress as a
news aggregator.
Simply paste the following code in any WordPress file that you choose. Preferrably in a custom page that you create.
01 | <?php include_once (ABSPATH.WPINC. '/feed.php' ); |
02 | $rss = fetch_feed( 'http://feeds.feedburner.com/wpbeginner' ); |
03 | $maxitems = $rss ->get_item_quantity(5); |
04 | $rss_items = $rss ->get_items(0, $maxitems ); |
07 | <?php if ( $maxitems == 0) echo '<li>No items.</li>' ; |
10 | foreach ( $rss_items as $item ) : ?> |
12 | <a href= '<?php echo $item->get_permalink(); ?>' |
13 | title= '<?php echo ' Posted '.$item->get_date(' j F Y | g:i a '); ?>' > |
14 | <?php echo $item ->get_title(); ?></a> |
Make sure you change the feeds url and the quantity and any other setting that you like
No comments: