Skip to content

Instantly share code, notes, and snippets.

@bpmore
Last active August 29, 2015 14:17
Show Gist options
  • Save bpmore/f10f622c9213de1cc5d0 to your computer and use it in GitHub Desktop.
Save bpmore/f10f622c9213de1cc5d0 to your computer and use it in GitHub Desktop.
ATU News Feed
<?php if(function_exists('fetch_feed')) {
include_once(ABSPATH . WPINC . '/feed.php'); // include the required file
$feed = fetch_feed('http://69.65.177.39/webcache/v1.0/rssDays/7/list-rss/no--filter.rss'); // specify the source feed
$limit = $feed->get_item_quantity(4); // specify number of items
$items = $feed->get_items(0, $limit); // create an array of items
$items = array_reverse($items); // display the sort correctly
$feed->set_cache_duration (43200); // cache the feed 43200=12 hours
}
if ($limit == 0) echo '<div>The feed is either empty or unavailable.</div>';
else foreach ($items as $item) : ?>
<div class="eventcontainer">
<div class="eventdate">
<span class="eventday"><?php echo $item->get_date('d'); ?></span>
<span class="eventmonth"><?php echo $item->get_date('M'); ?></span>
<span class="eventyear"><?php echo $item->get_date('Y'); ?></span>
</div>
<div class="eventtitle">
<a href="<?php echo $item->get_permalink(); ?>"
title="<?php echo $item->get_date('j F Y @ g:i a'); ?>">
<?php echo $item->get_title(); ?>
</a>
</div>
</div>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment