Show all creators

Following function shows the creator of the item on the page:

<?php echo metadata($item, array('Dublin Core', 'Creator')); ?>

Only problem is, when there are multiple creators, it only shows the first-added-creator.

How do I show all creators?


Use the option “all”

$creators = metadata($item, array('Dublin Core', 'Creator'), array('all' => true));
foreach ($creators as $creator):
    echo $creator;

See, there are a lot of interesting things for the theme builders.

Thanks! It works!
Very helpful link as wel! :slight_smile:

Hi Daniel, I think I have problems with the use of ‘All’ option. Could you check out where is the mistake please. Instead of the creator names (“Autores” in Spanish), it only shows the word “array”.

<?php if ($creator = metadata('item', array('Dublin Core', 'Creator'), 'all')): ?>
<?php echo __('Autor/es'); ?>: <?php echo array($creator); ?>
<?php endif; ?>

Thank you!

Hello, @silverio.

I think the problem is that your variable $creator contains an array, and not a single value; therefore, you can’t print its content straight away, but you need to loop through the array (f.i., with a foreach cycle, like @Daniel_KM was suggesting) or by using some specific function, as print_r ( for instance.

Hope this helps.