Returns the HTML markup for displaying a random item that has been marked as "featured." This helper is most commonly used on the home page of public themes. Since the HTML is pre-formatted, any changes to the HTML syntax must be made by writing out the necessary code instead of using the helper function. See random_featured_item for help with getting the item object of a random featured item.
<?php display_random_featured_item($withImage); ?>
- $withImage: boolean (default false) - specifies whether or not the featured item must have an image associated with it in order to be displayed. If set to true, this will either display a clickable square thumbnail for an item, or it will display "You have no featured items" if there are none with images.
To print the random featured item content, with an image, use the following code:
<?php echo display_random_featured_item(); ?>
To print the random featured item content, without an image, use the following code:
<?php echo display_random_featured_item(false); ?>
Here are the contents of display_random_featured_item() for your reference:
<h2>Featured Item</h2> <h3><a href="http://example.com/item/show/44">Item Title</a></h3> <img src="http://example.com/archive/square_thumbnails/thumbnail.jpg" class="image" /> <p class="item-description">Item description here....</p>