Forums » Shortcodes and item specific metadata

RSS feed for this topic

Info

  1. 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

  2. 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.

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

The forums are closed to new posts. To post new topics and read the latest discussions, please see the new forums.