Support

Account

Home Forums Add-ons Gallery Field Image of gallery as thumbnail on taxonamy page

Solving

Image of gallery as thumbnail on taxonamy page

  • Hello,

    I bought your plugin and it works very easy. Now I want to have the first image of the gallery shown on the taxonomy page. I have the following code displaying the posts:

    <?php
    if ( have_posts() ) :  
         echo '<ul>';
        while ( have_posts() ) : the_post();
          echo '<li>';
     if ( has_post_thumbnail() ) : ?>
        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
        <?php the_post_thumbnail(); ?>
        
          </a><br />
        <?php endif; ?>
         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
        <?php the_title(); ?>
        </a>
    	<?php
    	  echo  '</li>';
         endwhile;      
         echo '</ul>';
    endif;	 
     ?>

    what code do I have to place where to get the first image from the gallery shown in as thumbnail?

  • anybody an idea please?

  • or is this not possible?

  • just to get sure: you have no problem to show the gallery at the taxonomy page?
    but you wish to show only the first image from that gallery?

    have you try something like that?:

    <?php 
    $images = get_field('gallery_images');
        if( $images ){ 
            $image_1 = $images[0]; 
    }
    ?>
    <a href="<?php echo $image_1['url']; ?>">
     <img src="<?php echo $image_1['sizes']['large']; ?>" alt="<?php echo $image_1['alt']; ?>" />
    </a>
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Image of gallery as thumbnail on taxonamy page’ is closed to new replies.