Shortcodes and item specific metadata

Hi there,

I recently started to play with shortcodes, but I am not sure whether I got the precise connection between a shortcode's definition in application\views\helpers\Shortcodes.php and the actual output of the Simple Page right.

I added on a Simple page:

[items num=0 collection=10 sort="Dublin Core,Title" order=a]

As such it works very well, but the idea is to manipulating the output in a way that not only the item's title, but also a field from the metadata (either from Dublin Core or preferably from an item type specific field) is displayed next or below it. Thus far I added a variable in [OMEKA_ROOT]\application\views\scripts\items\single.php:

$meta = metadata($item, array('Item Type Metadata', 'crucialinformation'), array('snippet' => 50));

And let print its content if it is set:

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

Is that a/the preferable way to do it, or can one implement such feature in a shortcode as well?

Greetings,
Eric

That's probably the best way at it, with the exception that it would be better to copy the single.php file from the core into your theme's items/ folder, then make the changes there.

Oh okay, I see. Thank you for the feedback!