Make Jetpack Slideshow Block Images Clickable to View Full Size

Add this code to your child themes functions file to make your Jetpack slideshow block images clickable so you can view the full size of each slide.

add_action('wp_footer', 'inline_slideshow_script', 20);
function inline_slideshow_script() {
    ?>
    <script>
    jQuery(document).ready(function ($) {
        $(".wp-block-jetpack-slideshow_image").each(function () {
            var imageSrc = $(this).attr("src");
            $(this)
                .wrap('<a href="' + imageSrc + '" target="_blank"></a>');
        });
    });
    </script>
    <?php
}

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *