Adding metadata elements to the Embed Code plugin

I am trying to customize the display of the iFrame for the Embed Codes. In particular, I want to add more metadata elements.

I was able to add the Dublin Core description and date with this code in the embed.php file.

<?php if ($description = metadata('item', array('Dublin Core', 'Description'), array('snippet'=>350))): ?>
    <div class="item-description">
        <?php echo $description; ?>
    </div>
    <?php endif; ?>

        <?php if ($date = metadata('item', array('Dublin Core', 'Date'), array('snippet'=>250))): ?>
    <div style ="margin-top: 10px" >
        <?php echo "<font color='#D89966'>Date: </font>";?>
        <?php echo $date; ?>
    </div>

This works fine. However, when I add the same language for an Item Type Metadata element, the iframe ceases to show up or else the Item Type Metadata is ignored. For example, I have an Item type called "Articles" with an element called "Prepared By". I tried the following code, but it doesn't work:

<?php if ($preparedby = metadata('item', array('Item Type Metadata', 'Prepared By'), array('snippet'=>250))): ?>
    <div style ="margin-top: 10px" >
        <?php echo "<font color='#D89966'>Prepared By: </font>";?>
        <?php echo $preparedby; ?>
    </div>

I also tried this code by itself without the variables:

<?php echo item('Item Type Metadata', 'Prepared By'); ?>

Is my syntax wrong? Maybe I need to call the item type as well? I tried it with other item type elements that don't have a space, but it still didn't work.

Thanks,
Karen

What you have for getting $preparedby should work fine, and did the trick with a quick test with my site. If there's something else, like not closing the if statement, that could make the embed break.

Is there a site available someplace that I could look at to try what you have?

The item('Item Type Metadata', 'Prepared By') will definitely not work, since that function was removed in Omeka 2.0.

Thanks! I neglected to close the if statement because I had so many of them underneath!

Here's the full working code for anyone who might want to see it:

<?php if ($preparedby = metadata('item', array('Item Type Metadata', 'Prepared By'), array('snippet'=>250))): ?>
    <div style ="margin-top: 10px" >
        <?php echo "<font color='#D89966'>Prepared By: </font>";?>
        <?php echo $preparedby; ?>
    </div>
    <?php endif; ?>

Hooray!

Another option that might not require changing the file directly is to write a plugin that uses the embed_codes_content hook. It would just echo out whatever new content without modifying the embed.php file at all. The drawback of that is that, like many of our other hooks, it just appends the additional content to the end, instead of placing it where you want it.