WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] Repeating Image Field - Thumbnail Gallery? (5 posts)

  1. Matt Rittman
    Member
    Posted 1 year ago #

    If I have a repeating image field where the user can upload multiple images, is it possible to create a gallery on the front end? I want the user to be able to upload multiple images and on the front end, it would show a bunch of thumbnails. Then obviously if they clicked on the thumbnail, it would have a lightbox effect.

    The way I'm doing it now is a bit of a workaround. I created a WYSIWYG field where the user can use the "Add Media" button to create a gallery. The downside to this is, they could add text in there if they wanted... which I don't want them to be able to do.

    Anyway, the repeating image field seems like it would make the most sense. Is there a way to take the below code, and have the thumbnail gallery I was talking about?

    echo(types_render_field( "my_photo", array( "width" => "85", "height" => "35" ) ));

    The only way I figured out how to do a clickable thumbnail was with a non-repeating image and not a gallery:

    <a href="<?php echo(types_render_field( "photo1", array( "url" => "true" ) )); ?>"><?php echo(types_render_field( "photo1", array( "alt" => "Photo 1", "width" => "85", "height" => "35" ) )); ?></a>

    It would be really tedious to create say, 18 or so of these fields. Surely someone has done this before?

    http://wordpress.org/extend/plugins/types/

  2. mbigul
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Matt,

    Please try the following. Hope it will help you.

    $images = get_post_meta( get_the_ID(), 'wpcf-my-photo' );
    foreach($images as $k => $v){
    echo '<img src="' .$v. '">';
    }

    [ Signature moderated. ]

  3. Matt Rittman
    Member
    Posted 1 year ago #

    Bigul,

    I got it working using the below code:

    $images = get_post_meta( get_the_ID(), 'wpcf-photos' );
    	foreach($images as $k => $v){
    	echo '<a rel="lightbox[165]" href="' .$v. '"><img src="' .$v. '" width="58px" height="38px alt="" "></a>';
    	}

    How could I take it one step further and instead of resizing the image with HTML, to pull the thumbnail image generated from WordPress? That way when the page initially loads, it's not loading the full size images and just sizing them to my thumbnail sizes? Also, how could I pull in the alt tag information?

    Thanks for your help!
    Matt

  4. mbigul
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mat,

    It is not possible. You can achieve this easily by using our paid plug-in WP Views. Please check this link for more details http://wp-types.com/

    [ Signature moderated. ]

  5. Matt Rittman
    Member
    Posted 1 year ago #

    Thanks man that's completely understandable! I appreciate your help!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic