Add a tab to /items/show/xx


I would like to have an items/show/xx page with two tabs, one for the metadata and the other for a specific field which will contains a lot of text. The idea is to have all the informations about a person on the first one and a redacted bibliography with html recognition on the second tab.

Before looking deep into the csv files to do this manually, I would like to know if the community is aware of themes or addons which offers similar functionalities.

Have a nice day.

I’ve seen Omeka sites that have tabbed show pages, but no specific ones come to mind at the moment, and I don’t know of any available themes that do that out of the box. I think that would usually be tough to do as sites differ quite a lot in what they’d consider “main” information and “secondary” information.

This is a pretty easy change to make to whatever theme you want though. Just choose a tabbing framework you like, whether it’s JavaScript or mostly/purely CSS, add in the containers that requires, and split your content between those containers.

Thanks for the answer. I modified directly in html/css to add a tab.

For anyone who wants to do the same, I used the following code (see link below). One trick is to deactivate the clear:both for h1 title in the stylesheet. It allows to put a float element for h1 which produces a horizontal display of tabs.

Remove this:

  h1, h2 {

Ok, so I have my html+css code for displaying tabs when a item is viewed.

The problem now is to activate this code only for one type of items.

Here is the tabs code in /mytheme/items/show.php:

<div class="tabbed">

Tab 1

<?php if ($meta = metadata('item', array('Item Type Metadata', {TitleA'))): ?>


<?php echo $meta.' '; ?> <?php endif; ?>
  <?php if ($meta = metadata('item', array('Item Type Metadata', 'MetadataB'))): ?>
      <?php echo $meta.' '; ?>
  <?php endif; ?>
  <?php if ($meta = metadata('item', array('Item Type Metadata', 'metadataC'))): ?>
      <?php echo $meta.' '; ?>
  <?php endif; ?>

Tab 2

<?php if ($meta = metadata('item', array('Item Type Metadata', 'metadataD'))): ?> <?php echo $meta.' '; ?> <?php endif; ?>

I tried to surround this code with:

  if (isset($params['type'])){

[tabs code]

else {
    <?php echo all_element_texts('item'); ?> 

My purpose is to say: if the item is of item type 12, then display the tabs, if not, display all elements (like the default behavior).

it doesn’t work, any idea to achieve this?

If this is an Items show page, you’re close but just a bit off. Instead of your two if lines, try this:

if (metadata('item', 'item_type_name') == 'Your Item Type Name') {

Where obviously 'Your Item Type Name' is replaced with the name of your item type #12. You could also access the item directly:

if ($item->item_type_id == 12) {

The $params stuff you had would be more appropriate on a browse page, but on a show page you generally want to use metadata() or be accessing the $item variable directly when you want to test something about the item being viewed.

Thanks. It works perfectly!