zedejose / wp-flickitize-galleries

Turn your native WordPress galleries into beautiful sliders. Powered by the Flickity JS library.
1 stars 0 forks source link

Add support for image captions #2

Open hugobaeta opened 7 years ago

zedejose commented 7 years ago

Where in the markup do they go, though?

hugobaeta commented 7 years ago

That is a good question... By default WordPress adds a <figure> around the image, with the caption in <figcaption>, like so:

<div id="gallery-1" class="gallery galleryid-8 gallery-columns-1 gallery-size-full-width">
  <figure class="gallery-item">
    <div class="gallery-icon landscape">
      <img . . .>
    </div>
    <figcaption class="wp-caption-text gallery-caption" id="gallery-1-1847">Coworkers having coffee</figcaption>
  </figure>
  . . .

(no idea what that .gallery-icon.landscape is all about)

I'm not sure how flickity would behave withfigure being used as a .caroucel-cell wrapper instead of div...

zedejose commented 7 years ago

Only option seems to be (clunky) Javascript:

https://codepen.io/desandro/pen/dPdVNM