Skip to content

Commit

Permalink
Use new recent_items helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed May 1, 2014
1 parent 93ef5e3 commit 81b6053
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions index.php
Expand Up @@ -25,29 +25,21 @@
</div><!-- end primary -->

<div id="secondary">
<!-- Recent Items -->
<?php
$recentItems = get_theme_option('Homepage Recent Items');
if ($recentItems === null || $recentItems === ''):
$recentItems = 3;
else:
$recentItems = (int) $recentItems;
endif;
if ($recentItems):
?>
<div id="recent-items">
<h2><?php echo __('Recently Added Items'); ?></h2>
<?php
$homepageRecentItems = (int)get_theme_option('Homepage Recent Items') ? get_theme_option('Homepage Recent Items') : '3';
set_loop_records('items', get_recent_items($homepageRecentItems));
if (has_loop_records('items')):
?>
<ul class="items-list">
<?php foreach (loop('items') as $item): ?>
<li class="item">
<h3><?php echo link_to_item(); ?></h3>
<?php if($itemDescription = metadata('item', array('Dublin Core', 'Description'), array('snippet'=>150))): ?>
<p class="item-description"><?php echo $itemDescription; ?></p>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<p><?php echo __('No recent items available.'); ?></p>
<?php endif; ?>
<p class="view-items-link"><?php echo link_to_items_browse(__('View All Items')); ?></p>
</div><!-- end recent-items -->
<?php echo recent_items($recentItems); ?>
<p class="view-items-link"><a href="<?php echo html_escape(url('items')); ?>"><?php echo __('View All Items'); ?></a></p>
</div><!--end recent-items -->
<?php endif; ?>

<?php fire_plugin_hook('public_home', array('view' => $this)); ?>

Expand Down

0 comments on commit 81b6053

Please sign in to comment.