Add image caption for The Daily Theme

I am using the “The Daily” theme which has a great image viewer/slider for media attached to an item. It however does not show any caption of the images when viewing the image. Any idea on how to add the media Title as the caption?

From what I understand, it uses lightslider to show the images and as far as I can see, it should be possible to add a transparant caption over the image. No idea on how to implement this however?



Hi Jeroen. You can edit a caption to image viewer media by editing view/omeka/site/item/show.phtml. Go to line 35 and replace it with the following:

<li data-src="<?php echo $source; ?>" data-sub-html="<?php echo $media->displayTitle(); ?>" vsdata-thumb="<?php echo $escape($media->thumbnailUrl('medium')); ?>" class="media resource">

The data-sub-html attribute is what you need. Here I’ve populated it with the media’s display title. If you want to do an attribute like the media description, you could do data-sub-html="<?php echo $media->displayDescription(); ?>".

I’ll also make this into a future theme setting that can be accessed from the Omeka S admin.

That works great, thanks!

@kim - I was too quick with my response. It does show the caption now, when you click the photo (media). I however lost the thumbnails of the different photos (media items) beneath the fotos.

@kim resolved it. Tere is an error in he code above. Halfway it states vsdata-thumb=
This of course needs to be data-thumb=

Removed the vs and it works fine now.

Sorry about that, odd typo on my part!

@kim is it possible to display more them one attribute as the caption. For example the Title, Creator and Date?

Ah , found it already. It is possible to display separate attributes via the value method.
To add the Date for example I used:

echo $media->value('dcterms:date')->asHtml();
1 Like

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.