Image Carousel
Add multiple images in a carousel
Block names
t2/image-carousel, t2/image-carousel-image
Properties (t2.json)
Show pagination dots for the slider.
Number of slides per view.
Add a mobile breakpoint for the carousel with more than 2 images.
Add the space (in pixels) between the carousel slides.
Add the space (in pixels) between the carousel slides in the mobile view.
Default number of slides per view.
icons
Icon used for the previous arrow in the image carousel.
Icon used for the next arrow in the image carousel.
Icon used to open the image in a lightbox.
Icon used for the close button in the lightbox.
Icon used for the left arrow in the lightbox.
Icon used for the right arrow in the lightbox.
features
Array of supported effects.
features.aspect-ratio
Default aspect ratio.
Array of supported aspect ratios. It will also contain the default value if it is not present in the list.
Style properties
Icon color
- --t2-image-carousel-color-icon
- Theme.json: wp.custom.t2-image-carousel.color.icon
- Default: #fff
Color of the background
- --t2-image-carousel-color-background
- Theme.json: wp.custom.t2-image-carousel.color.background
- Default: #000
Wrapper row gap (between main carousel and thumbnails)
- --t2-image-carousel-row-gap
- Theme.json: wp.custom.t2-image-carousel.row-gap
- Default: var(--wp--preset--spacing--40)
Gap between image and caption
- --t2-image-carousel-caption-gap
- Theme.json: wp.custom.t2-image-carousel.caption.gap
- Default: --wp--preset--spacing--30
Gap between pagination bullets
- --t2-image-carousel-pagination-gap
- Theme.json: wp.custom.t2-image-carousel.pagination.gap
- Default: --wp--preset--spacing--20
Color of the pagination bullet
- --t2-image-carousel-color-pagination-bullet
- Theme.json: wp.custom.t2-image-carousel.color.pagination-bullet
- Default: var(--wp--preset--color--foreground,
Color of the pagination bullet on hover
- --t2-image-carousel-color-pagination-bullet-hover
- Theme.json: wp.custom.t2-image-carousel.color.pagination-bullet-hover
- Default: rgba(0,
Color of the active pagination bullet
- --t2-image-carousel-color-pagination-bullet-active
- Theme.json: wp.custom.t2-image-carousel.color.pagination-bullet-active
- Default: rgba(0,
Image sources
The block supports three mutually exclusive image sources, selected via "Image source" in the sidebar. Switching source never clears data from the other modes.
Media library (default)
Images are picked from the WordPress media library. Each image is stored with its attachment id and url. This is the original behaviour and is fully unchanged.
External URLs
Images are entered as plain URLs in the sidebar, one per image entry. Each entry also has optional Alt text and Caption fields. No media library modal is shown.
The externalImages attribute stores the list:
[
{ "url": "https://example.com/photo.jpg", "alt": "A photo", "caption": "Photo caption" }
]
Post meta
Images are read from a post meta field at render time. The meta field must contain an array of URL strings. Both native PHP serialised arrays (already decoded by WordPress) and JSON-encoded strings (e.g. stored via json_encode / JSON.stringify) are supported.
Select the meta key from the dropdown in the sidebar — only meta keys whose value is an array are listed. No media library modal is shown.
The metaKey attribute stores the chosen meta key name:
{ "metaKey": "vehicle_picturesPaths" }
Example meta value (either format is accepted):
["https://example.com/img1.jpg", "https://example.com/img2.jpg"]
Hooks
t2/block/image-carousel/image_sizeFilters the carousel image size. Has 2 params:$image_size,$attributes, returns a string.