Archived topic
How to get image caption in gallery below the image
7 replies · Started by Milan on January 6, 2021
Hello GP team,
i am trying to get image caption (in gallery) below the image in the same manner as single images captions are.
I tried edit some code from forum but nothing works.
Thank you for your help.
Milan
Hi there,
can you share a link to where i can see the issue ?
Hi David, for example - https://jizda-zazitkova.cz/jizda-v-dodge-challenger . When I reduce screen size the caption of images in gallery is to big. I would like to get image caption (in gallery) below these images. If is it possible :)
Typically this should be a question for WordPress support team as the gallery block and the CSS is all handled by WP itself.
However, you can try something like this:
.blocks-gallery-grid .blocks-gallery-image figcaption, .blocks-gallery-grid .blocks-gallery-item figcaption, .wp-block-gallery .blocks-gallery-image figcaption, .wp-block-gallery .blocks-gallery-item figcaption {
position: unset;
}
.blocks-gallery-grid .blocks-gallery-image figure, .blocks-gallery-grid .blocks-gallery-item figure, .wp-block-gallery .blocks-gallery-image figure, .wp-block-gallery .blocks-gallery-item figure {
flex-direction: column;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
Thank you Leo. It works but images in the gallery that do not have the same height are not align to the same height. You can see this issue for example - https://jizda-zazitkova.cz/jizda-na-ducati/ (bottom gallery). Do you have any ideas?
Hi there,
there isn't a simple automated method to resize images to fill the same height of a gallery row. The simplest fix is to crop your original images so they all have the same aspect ratio.
Ok, thank you for your time guys! :)
Glad we could be of help