Gallery with thumbnails linking to PDF files
-
Hi stianlik,
great plugin, thanks for your work.
I was wondering if it’s actually possible to create a gallery with PDF thumbnails where each thumbnail links to the respective PDF file. Do you already have a good solution for this?
So far, I used a quite “dirty” JS/jQuery workaround:
var $ = jQuery; $(document).ready(function(){ if($('.pdf-archive').length) { $('.gallery-item').each(function(){ var url = $(this).find('a').attr('href'); var newurl = url.replace('-pdf-image.jpg','.pdf'); $(this).find('a').attr('href',newurl); }); } });I place a <div> with a “pdf-archive” class somewhere on the page to show that it’s a PDF archive. If an element with this class exists, I manipulate all the gallery item links so that they link to the respective PDF file.
However, in my point of view the best way to do this would be a third option within the gallery settings for the gallery link: “PDF file”. And if no PDF file exists for one of the gallery items, media file or attachment page can be set as a fallback.
What do you think? Would that be complicated to implement?
Best regards
joschi81
The topic ‘Gallery with thumbnails linking to PDF files’ is closed to new replies.