$recentItems = get_theme_option('Homepage Recent Items'); if ($recentItems === null || $recentItems === '') { $recentItems = 3; } else { $recentItems = (int) $recentItems; } 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_item_obj(array('recent' => true, 'type' => 'Text'), $homepageRecentItems)); if (has_loop_records('items')) { ?> <ul class="items-list"> <?php foreach (loop('items') as $item) { ?> <li class="item"> <?php if (metadata('item', 'has thumbnail')) { ?> <?php echo files_for_item(array('item_image' => 'square_thumbnail', 'imgAttributes' => array('alt' => 'Thumbnail for the first content page of the item, linking to the full file.'))); ?>
<ul class="items-list"> <?php asort($collections); ?> <?php foreach ($collections as $collection) { ?> <?php set_current_record('collection', $collection); ?> <?php if (metadata($collection, 'total_items') > 0) { ?> <?php $cid = metadata($collection, 'id'); set_loop_records('items', get_item_obj(array('sort_field' => 'random', 'collection' => $cid, 'type' => 'Text')), 1); ?> <?php foreach (loop('items') as $item) { ?> <li class="item"> <?php if (metadata('item', 'has thumbnail')) { ?> <?php echo files_for_item(array('item_image' => 'square_thumbnail', 'imgAttributes' => array('alt' => 'Thumbnail for the first content page of the item, linking to the full file.'))); ?> <?php } ?> <h3><?php