Skip to content

Instantly share code, notes, and snippets.

@bpmore
Created March 25, 2016 19:47
Show Gist options
  • Save bpmore/79fefdb447f702c07396 to your computer and use it in GitHub Desktop.
Save bpmore/79fefdb447f702c07396 to your computer and use it in GitHub Desktop.
ATU Calendar 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/2/list-rss/no--filter.rss'); // specify the source feed
$limit = $feed->get_item_quantity(8); // 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
date_default_timezone_set('America/Chicago');
}
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