Showing multiple titles for a single item

We have items with multiple titles (the title in Czech and in English) and would like both to display in the Browse Items and on the Featured and Recently Added interfaces.

Both are DC:Title for each item, so items have multiple titles, but only one title is displaying. (To be clear, both titles show when in item view, so the metadata is there and visible.)

Thank you

You’ll need to edit your theme for this: pretty much all themes are written for those “Browse” and “featured” type interfaces to only show a single title, the first one.

You’d be looking at the items/browse.php and items/single.php views… the basic change is that you need to use a call like

metadata('item', array('Dublin Core', 'Title'), array('all' => true))

to get you an array of all the Titles rather than just the first one.

Excellent. Thank you. We haven’t chosen a theme yet but I’m glad we have an approach to this.

This doesn’t appear to be working. I tried changing the Berlin theme’s browse.php such that

<?php echo link_to_item(metadata('item', array('Dublin Core', 'Title')), array('class'=>'permalink')); ?>

looks like

<?php echo link_to_item(metadata('item', array('Dublin Core', 'Title'), array('all' => true)), array('class'=>'permalink')); ?>

but it doesn’t seem to be working for me. I get all titles displaying as “Array” instead.

Any ideas?

Figured it out. I installed the Dublin Core Extended and added the second title as Alternative Title.

Then in the browse, I added a second line, such that you get this:

<?php echo link_to_item(metadata('item', array('Dublin Core', 'Title')), array('class'=>'permalink')); ?> <?php echo link_to_item(metadata('item', array('Dublin Core', 'Alternative Title')), array('class'=>'permalink')); ?>

And that allowed both titles to appear in the browse.

Your first way was fine too, it’s just that you can’t simply echo an array, doing that just prints, as you saw, the text “Array.”

You loop over an array to print its items:

$titles = metadata('item', array('Dublin Core', 'Title'), array('all' => true));
foreach ($titles as $title):
    echo $title;

Excellent, thanks for the updated PHP.