Adding new field to ItemFunctions

Hi- in the Featured section, I want to add the Country value after the Description snippet, but the code I added to the ItemFunctions is producing errors. I'm still learning php and will appreciate any help to spot the problem.

function display_random_featured_item($withImage=false)
 {
    $featuredItem = random_featured_item($withImage);
 	$html = '<h2>Featured Item</h2>';
 	if ($featuredItem) {
 	    $itemTitle = item('Dublin Core', 'Title', array(), $featuredItem);

 	   $html .= '<h3>' . link_to_item($itemTitle, array(), 'show', $featuredItem) . '</h3>';
 	   if (item_has_thumbnail($featuredItem)) {
 	       $html .= link_to_item(item_square_thumbnail(array(), 0, $featuredItem), array('class'=>'image'), 'show', $featuredItem);
 	   }
 	   // Grab the 1st Dublin Core description field (first 150 characters)
 	   if ($itemDescription = item('Dublin Core', 'Description', array('snippet'=>150), $featuredItem)) {
 	       $html .= '<p class="item-description">' . $itemDescription . '</p>';
       }
        // Grab the Dublin Core Country field
 	   if ($itemCountry = item('Dublin Core', 'Country', array(), $featuredItem)) {
 	       $html .= '<p class="item-country">' . $itemCountry . '</p>';
       }
 	} else {
 	   $html .= '<p>No featured items are available.</p>';
 	}

     return $html;
 }

Hi aropro,

Could you confirm that 'Country' is in fact a field in your Dublin Core element set? It's not in that element set by default in Omeka, and we don't offer a way to add custom fields to it. If you've added it to an Item Type, which would be my first guess, you could call it by using:

item('Item Type Metadata', 'Country', array(), $featuredItem);

That's it. Country is an Item Type Metadata. The code is now working. Thanks, Jeremy, for providing a second pair of eyes!

Glad to help!