• Resolved emma_08

    (@emma_08)


    Hi,
    Is there a specific plugin for Pods to create a lightbox for custom post type image fields?
    I tried a couple of plugins such as: Simple Lightbox plugin (https://www.ads-software.com/plugins/simple-lightbox/). This works on regular image posts, but not on Pods image fields. My custom post type in standard, not advanced, and the images are outputted as so: <?php echo pods_image( get_post_meta( $post->ID, ‘small_image’, true ), ‘original’ ); ?>.

    Is there a tweak that needs to be done in order to get it working?

    Any lead would be greatly appreciated.

    Thank you!

    https://www.ads-software.com/plugins/pods/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    The key on that one is you have to setup the image links the way Simple Light Box advises:

    The key is the Image Link section in the aforementioned documentation. You need to make sure that this option is set to either Attachment Page or Media File before you insert the image into your post. This will wrap the inserted thumbnail image with a link that loads the full-size version of the image when it is clicked. Thanks to SLB, the full-size image will be displayed in a lightbox rather than loading an entirely new page.

    That means your images can’t just be output as images, they have to be output the way the Plugin author advises, wrapping the thumbnail with a link that loads the full size version of the image when it is clicked. You can either check for that syntax and output it in your echo above, or use one of the WordPress image output functions.

    This response about the best way to Display Pod based Images in your Template file explains the relationship between outputting images that way:

    https://stackoverflow.com/questions/21918954/the-best-way-to-display-pod-based-images-in-your-template-file

    Thread Starter emma_08

    (@emma_08)

    Hi,
    Thanks for your clear response!
    Now since the image field is in a custom post type, the “attachment display settings” don’t appear in the media uploader. The other way, as you mentioned, is add it in php, would you know how to place the following into links? I’m pretty new to php and unsure of how to do it. I’m using the image ouput code from the stackoverflow.com link you provided. (p.s. I have 2 sets of images, each have multiple images).

    <?php
    if ( get_post_meta( get_the_ID(), ‘large_image’, false ) ){
    $image_array = get_post_meta( get_the_ID(), ‘large_image’, false );
    }
    if ( $image_array ) {
    echo ‘

      ‘;
      foreach ( $image_array as $image ) {
      $class = “post-attachment mime-” . sanitize_title( $image->post_mime_type );
      $thumbimg = wp_get_attachment_image( $image[‘ID’], ‘original’);
      echo ‘<li class=”‘ . $class . ‘ data-design-thumbnail”>’ . $thumbimg . ”;
      }
      echo ‘

    ‘;
    }
    ?>

    <?php
    if ( get_post_meta( get_the_ID(), ‘small_image’, false ) ){
    $image_array = get_post_meta( get_the_ID(), ‘small_image’, false );
    }
    if ( $image_array ) {
    echo ‘

      ‘;
      foreach ( $image_array as $image ) {
      $class = “post-attachment mime-” . sanitize_title( $image->post_mime_type );
      $thumbimg = wp_get_attachment_image( $image[‘ID’], ‘original’);
      echo ‘<li class=”‘ . $class . ‘ data-design-thumbnail”>’ . $thumbimg . ”;
      }
      echo ‘

    ‘;
    }
    ?>

    Thanks again,
    Emma

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Lightbox for Pods Image fields’ is closed to new replies.