Support » Plugin: Toolset Types - Custom Post Types, Custom Fields and Taxonomies » Displaying Thumbnail from Custom Field Uploaded Image

  • I created a gallery using Types custom fields. Everything works fine except that when I change/upload a different main image for a gallery post, the thumbnail in the main gallery stays the original image. For reference see these pages:

    On this main gallery page: Galleries, look at the thumbnail for the page “Birdie‚Äôs “B” Dazzled Ring in Ocean Blue”. This is the thumbnail for the first main image that was uploaded.

    Now click on that thumbnail and go to the: Main Image Page and you will see the current but different image which is the last one that was uploaded.

    I am using the following code to call the thumbnail into the main gallery template:

    <?php $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    	if ( $images ) :
    	$total_images = count( $images );
    	$image = array_shift( $images );
    	$image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
    <figure class="gallery-thumb">
     <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    </figure><!-- .gallery-thumb -->

    How do I get the main gallery thumbnail to update to the most recent main image?

  • The topic ‘Displaying Thumbnail from Custom Field Uploaded Image’ is closed to new replies.