How to Edit Recently Added Items

Can anyone help me locate the file in Omeka where I can edit the Recently Added Items box on the homepage? (I'm using the Seasons theme.)

I am trying to change the metadata that appears next to the recently added items on the homepage. By default, it seems to be just the title and thumbnail. (I think it also pulls in the Dublin Core description field, but we are using item type metadata for that field, so it's not appearing.) I want to get the creator and publication date fields to also show up next to each recently added item. I was successful in doing this for the item browse page and collections show page. I want to do the same thing for recently added items but I can't find the file!

I assumed I would find this code under /var/www/themes/seasons/index.php. And there is some code for recently added items there. However, the php code that determines which metadata elements appear in this box is not in this file.

Can anyone tell me where the file I'm looking for is located?

Thanks,

Anne

You'll want to copy the default display found in application/views/scripts/items/single.php into your seasons folder as per this guide.

Sounds like the same things you did elsewhere will work for the changes to this file.

Off the top of my head, I don't know where else the changes will appear, but it is possible that the changes will also happen elsewhere.

Hi there,

Thank you so much for your response! I was able to copy the file into my theme folders.

I guess now I'm running into the issue that the changes aren't appearing as I'd like. So I'd like each recently added item to list the title, thumbnail, creator, publication date, and description.

The original code looked like this:

<div class="item record">
    <?php
    $title = metadata($item, array('Dublin Core', 'Title'));
    $description = metadata($item, array('Dublin Core', 'Description'), array('snippet' => 150));
    ?>
    <h3><?php echo link_to($item, 'show', strip_formatting($title)); ?></h3>
    <?php if (metadata($item, 'has files')) {
        echo link_to_item(
            item_image('square_thumbnail', array(), 0, $item),
            array('class' => 'image'), 'show', $item
        );
    }
    ?>
    <?php if ($description): ?>
        <p class="item-description"><?php echo $description; ?></p>
    <?php endif; ?>
</div>

I changed the portion that pulls in the description so that it pulls it from the item type metadata field instead, and that worked with no problem. However, I also tried to add additional code to pull in the creator and pub date, but that didn't work. Here's what I tried:

<?php
    $title = metadata($item, array('Dublin Core', 'Title'));
    $description = metadata($item, array('Item Type Metadata', 'Description'), array('snippet' => 150));
$description = metadata($item, array('Item Type Metadata', 'Creator'), array('snippet' => 150));
$description = metadata($item, array('Item Type Metadata', 'Publication Date'), array('snippet' => 150));
    ?>

This brought in the publication date but took away the description (and creator never appeared). I tried taking away pub date code, and just the creator info showed up. So it seems to only let me display one additional field (besides title and thumbnail).

Any ideas on how to get around that?

There might be more at work in the full file, but from what you posted, it looks like $description is assigned twice, for different things.

That was it! Well, part of it. The other part of the problem is I don't know anything about php! Anyway, I pieced somethings together and got it to work. So I'm including the full code for my single.php file here, just in case anyone else would like to do something like this in the future. FYI, changing this file impacted the Recently Added Items and Featured Item boxes on my homepage.

<div class="item record">
    <?php
    $title = metadata($item, array('Dublin Core', 'Title'));
 $description = metadata($item, array('Item Type Metadata', 'Description'), array('snippet' => 150));
 $creator = metadata($item, array('Item Type Metadata', 'Creator'));
 $interviewee = metadata($item, array('Item Type Metadata', 'Interviewee'));
 $publicationdate = metadata($item, array('Item Type Metadata', 'Publication Date'));
 $date = metadata($item, array('Item Type Metadata', 'Date'));
 $eventdate = metadata($item, array('Item Type Metadata', 'Event Date'));

   ?>
    <h3><?php echo link_to($item, 'show', strip_formatting($title)); ?></h3>
    <?php if (metadata($item, 'has files')) {
        echo link_to_item(
            item_image('square_thumbnail', array(), 0, $item),
            array('class' => 'image'), 'show', $item
        );
    }
    ?>
<?php if ($creator): ?>
<p class="item-creator"><?php echo $creator; ?></p>

<?php elseif ($interviewee): ?>
<p class="item-creator"><?php echo $interviewee; ?></p>
<?php endif; ?>

<?php if ($publicationdate): ?>
<p class="item-date"><?php echo $publicationdate; ?></p>

<?php elseif ($date): ?>
<p class="item-date"><?php echo $date; ?></p>

<?php elseif ($eventdate): ?>
<p class="item-date"><?php echo $eventdate; ?></p>

<?php endif; ?>

<?php if ($description): ?>
<p class="item-description"><?php echo $description; ?></p>
<?php endif; ?>

</div>

Thank you very much again for your help!