Hello, I'd like to use the recent items function to loop through only the most recent images.
Right now, I'm using this...
<div id="recent-items">
<h2>Recently Added Items</h2>
<?php set_items_for_loop(recent_items(8)); ?>
<?php if (has_items_for_loop()): ?>
<div class="items-list">
<?php while (loop_items()): ?>
<div class="item">
<?php if(item_has_thumbnail()): ?>
<div class="item-img">
<?php echo link_to_item(item_square_thumbnail()); ?>
</div>
<?php endif; ?>
</div>
<?php endwhile; ?>
</div>
<?php else: ?>
<p>No recent items available.</p>
<?php endif; ?>
<p class="view-items-link-home"><a href="<?php echo uri('items'); ?>">View All Items</a></p>
</div>
This generally works except when any of the recent items are non-images (PDFs, etc) in which cae, I'm just left with the empty div I used in my stylesheet.
------------
Okay, actually I found the answer before I finished posting to I'll just put it here in case anyone is looking for the same thing!
take the code above but use this...
<?php set_items_for_loop(get_items(array('recent' => true,'type' => 'Image'),8));?>
instead of this...
<?php // set_items_for_loop(recent_items(8)); ?>
