Image popup

Mauer Themes Support Storyteller Image popup

This topic contains 1 reply, has 2 voices, and was last updated by  Paul 2 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #496

    ancienticon
    Participant

    Hi, I have been using your theme but making some changes to it as my use isn’t for a blog. I also unhid the custom fields menu item because I wanted to use it.

    I’m making this site for an artist, and made a custom content type for his artwork. I want the same functionality as your demo content has though, when you click an image and it pops up and is zoomable.

    Do you know how I can add that functionality to the images I’m using with ACF? Right now I’m just using:

    <img src="<?php the_sub_field('image'); ?>" alt="" />

    Thanks

    Work

    #497

    Paul
    Keymaster

    Hello,

    The functionality that you mentioned (getting a zoomable lightbox when you click a picture) is achieved by using the native WordPress [gallery] shortcode.

    Here is how it works under the bonnet:
    The theme overrides the default html that is generated by WP for the [gallery] shortcode. This is done by the mauer_gallery() function contained in the functions.php file of the theme. This function creates the markup for the PhotoSwipe library. This library, in turn, generates the lightbox.

    By the code you posted I’m assuming you are trying to do that in a template file. So what you want to do is execute the shortcode the php way:

    <?php echo do_shortcode('[gallery ids="179,180,181,182,183"]'); ?>
    You can have one or more ids in the code above.

    However I would also consider a solution where you don’t attach images through ACF and just use the native WP gallery (as in the demo content). I believe that can turn out to be much more convenient.

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

The topic ‘Image popup’ is closed to new replies.