Pull thumbnails from Featured Exhibits for hompage

So I am working on manipulating the omeka homepage a bit for my project. I have the "featured collections" and the "featured exhibits" galleries on my homepage. The "featured collections" gallery includes four images thumbnails from the collection that is featured. I am trying to do the same for the featured exhibit but am running into some difficulties. So far I have been able to make four thumbnails appear right below the "featured exhibits" gallery, in the right place, and as the right size by using the same div id and styling as the featured collection thumbnails, but I seem to be pulling from all featured items rather than the particular featured exhibit that I have on the homepage. I have gotten to this point by manipulating the code on the index.php file of theme immediately following the function for displaying the information on the featured exhibit. This is the code that I have so far:

<div id="index-collection-img">
<?php
$items=get_records('item', array('hasImage'=>true, 'featured'=>true, 'Exhibit'=>$exhibit),$num=4);
if(count($items)>=$num){
set_loop_records('items', $items);
if (has_loop_records('items')){
foreach (loop('items') as $item){
echo link_to_item(item_image('square_thumbnail'));
}
}
}?>
</div><!-- end exhibit-items -->

Any suggestions on how to manipulate (or scrap this and start over) this in order to pull four thumbnails from items with images in the exhibit that is being featured on the homepage?

Putting 'featured'=>true in the params will make it look for items that are featured, so you can leave that off.

The 'Exhibit'=>$exhibit part should be 'exhibit'=>$exhibit , assuming that $exhibit has the correct data in it.

Thanks a lot. I guess that prompts a follow up: how do I make sure the $exhibit has the correct data in it and, if it does not, how do I make sure it does? Do I just define:


$exhibit=get_records('Exhibit', array('featured'=>true));

above:

$items=...

or do I need to look/manipulate it someplace else? (Or manipulate it differently in the same spot).

get_records() will give you back an array, so you'd have to loop through that

Got it! Thanks a lot. For anyone else who might look at this, the final code looks like this on the index.php file in the theme immediately under the "featured exhibit" section:


<div id="index-collection-img">

<?php
$exhibits=get_records('Exhibit' , array ('featured'=>true));
foreach (loop('exhibit',$exhibits) as $exhibit){
$items=get_records('item', array('hasImage'=>true, 'exhibit'=>$exhibit),$num=4);
if(count($items)>=$num){
set_loop_records('items', $items);
if (has_loop_records('items')){
foreach (loop('items') as $item){
echo link_to_item(item_image('square_thumbnail'));
}
}
}
}
?>
</div><!-- end exhibit-items -->

This is exactly what I need! Thanks for posting this! How would one go about manipulating the code for displaying the thumbnails of items and collections?