Functions/random featured item

Description

random_featured_item returns one Item object that has been marked featured.

Usage

<?php random_featured_item($hasImage); ?>

Arguments

  • $hasImage - Default value is true. Setting to true or false will return a random featured item that has or doesn't have an image file associated with it.

Examples

The following example sets a variable $item to a random featured object without an image, which can then be used in other functions.

<?php $item = random_featured_item(false); ?>

Taking the above example a few steps further, we can display metadata from the random featured item by setting it as the current item:

<?php
 
$item = random_featured_item(false);
set_current_item($item);
echo '<h2>'.item('Dublin Core', 'Title').'</h2>';
 
?>