Created
June 9, 2012 04:30
-
-
Save onestepcreative/2899477 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // RSS Dashboard Widget | |
| function freshDashboardRSS() { | |
| if(function_exists('fetch_feed')) { | |
| include_once(ABSPATH . WPINC . '/feed.php'); // include the required file | |
| $feed = fetch_feed('http://blog.onestepcreative.com/feed/rss/'); // specify the source feed | |
| $limit = $feed->get_item_quantity(7); // specify number of items | |
| $items = $feed->get_items(0, $limit); // create an array of items | |
| } | |
| if ($limit == 0) echo '<div>The RSS Feed is either empty or unavailable.</div>'; // fallback message | |
| else foreach ($items as $item) : ?> | |
| <h4 style="margin-bottom: 0;"> | |
| <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo $item->get_date('j F Y @ g:i a'); ?>" target="_blank"> | |
| <?php echo $item->get_title(); ?> | |
| </a> | |
| </h4> | |
| <p style="margin-top: 0.5em;"> | |
| <?php echo substr($item->get_description(), 0, 200); ?> | |
| </p> | |
| <?php endforeach; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment