Support

Home Forums Add-ons Gallery Field thumbnails not responsive

Solving

thumbnails not responsive

  • Hello,

    I’m using ACF Pro, and i’m trying to make a wp gallery with gallery field, thru shortcode with the code from Support pages

    <?php 
    
    $image_ids = get_field('gallery', false, false);
    $shortcode = '[' . 'gallery ids="' . implode(',', $image_ids) . '"]';
    
    echo do_shortcode( $shortcode );
    
    ?>

    And it works but the thumbnails are not responsive, they just collapse while minimizing the width, and wp gallery thumbnails are responsive.

    Why the ACF gallery thumbnails don’t work as the wpgallery thumbnails?

    Thanks
    Albert

  • It’s a matter of my theme!:/

  • This is just a guess. The reason that the WP gallery is responsive when added to the content wysiwyg editor is probably because it is in the content wysiwyg editor. Images are made responsive by WP by applying a filter to the content that does this and this filter is not run when calling do_shortcode() from the template.

    You can try this, but I don’t know if it will work

    
    echo wp_make_content_images_responsive(do_shortcode( $shortcode ));
    
  • I’ve tried it but didn’t work, It’s my theme I guess, I gonna ask to my theme support.

    Thanks for your attention!!
    Regards!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.