Retrieve an array of image URLs that belong to a gallery

admin2025-06-04  2

I am creating an image slider for the gallery post type. The code below works fine with the classic gallery, however when I use the new Gutenberg gallery block the get_post_gallery_images() function doesn't retrieve the array of image URLs.

$images = get_post_gallery_images();
echo '<div class="image-row">';
    foreach ( $images as $image ) {
        echo '<div class="image-container">';
            echo '<img src="' . $image . '" />';
        echo '</div>';
    }
echo '</div>';
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749013684a315619.html

最新回复(0)