kenwheeler / slick

the last carousel you'll ever need
kenwheeler.github.io/slick
MIT License
28.33k stars 5.88k forks source link

Gutenberg gallery figcaption displayed as slide #4184

Open shanethanic opened 2 years ago

shanethanic commented 2 years ago

Inherited a site that uses the gutenberg gallery block and slick to make slideshows. With the WP 5.9 update & new gallery structure, the slideshows got all messed up.

Worked out a way to get the sliders working with the new structure, while retaining the styling and function of the "old" ones (WP is honoring the old structure until a page is updated, so both need to work). Now, the (new) slideshows are displaying the gallery caption as a slide.

When initializing slick, the new gallery goes from a bunch of nested images in a figure with "has-nested-images" class to a bunch of figures within slick divs within the "has-nested-images" class. Thing is, the figcaption is wrapped up in one of the slick divs (the first one, for some reason), listed as "slide00", so it shows as the last slide, rather than being under the gallery.

====================================================================

This is the JS that makes it so both old & new structure galleries work as slideshows. Idk if I should just be relying on styling to pull the captions out, or if there is something I can do with the JS file.

Screen Shot 2022-04-21 at 6 28 06 PM
ahmadalfy commented 2 years ago

@shanethanic can you share the HTML?