dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.38k stars 3.49k forks source link

Adding image description to lightbox #216

Open peter2211 opened 11 years ago

peter2211 commented 11 years ago

I have a wordpress site (with woocommerce plugin) that came with Magnific-Popup. The lightbox is triggered on the single product pages to view product images in the lightbox.

The only issue is that the description (or caption) for the images is not displayed in the lightbox. For example, "Item shown in Blue".

Is there a snippet of code I could use to get that function to work? And if so, where would I put it? I read the documentation, and I can navigate my way around template files, but just could not figure it out.

Thank you for any help you could give.

Cheers,

carasmo commented 11 years ago

On the link calling image add title tag to that link such as:

    title="Add a title on the image"

Then that will be the title of the image.

peter2211 commented 11 years ago

Thanks Carasmo. Perhaps I need to explain further. Since there are about 10 images associated with each product, I need the text to automatically pull from the 'description', or 'caption' field, which are filled out when adding images via the uploader....

Any advice?

Thanks,

carasmo commented 11 years ago

Don't work with wordpress but I imagine it's like any other database driven CMS. You'd locate the code (smarty, php, whatever) and find the loop and locate the tag you're supposed to use and plop it in the a href tag's title field. You'll probably need to find a wordpress person to help you and you'll need to use something to strip out entities too (they will know what I mean).

synergywp commented 11 years ago

Try applying a filter to the output of the WP image. I'm assuming you can do that. You'll need to grab the attachment caption, description etc, and set them to something like data-caption, data-description in the tag.

nara-l commented 10 years ago

Don't forget to add this in the initialization of the gallery: image: { titleSrc: 'title', } // Attribute of the target element that contains caption for the slide.