how to display each gallery image in category page

i want to make categories gallery. so i have one category called gallery, i create some post with gallery images. in gallery category page i want to display each post 4 picture. picture will take from advancedcustomfields gallery field. bellow is my current category-gallery page code, image not coming but title and more link working fine. would guys tell me what how to do ?

<?php get_header(); ?>

<div class="contentarea">
  <div class="wapper">
    <div class="content clearfix">
      <?php 
    while ( have_posts() ) :
    the_post();
    $images = get_field('gallery_picture');

    ?>
      <h2><a href="<?php  the_permalink(); ?>">
        <?php  the_title(); ?>
        </a></h2>
      <a href="<?php echo $image['url']; ?>"> <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" /> </a> <a href="<?php  the_permalink(); ?>" class="info">Gallery</a> </div>
    <?php  endwhile; ?>
  </div>
</div>
</div>
<?php get_footer(); ?>

Related posts

1 comment

  1. i solve this problem. so want to share with other. this for category page. bellow is code

          <?php 
        while ( have_posts() ) :
        the_post();
    
    
        ?>
          <h2><a href="<?php  the_permalink(); ?>">
            <?php  the_title(); ?>
            </a></h2>
          <?php
    $images = get_field('gallery_picture');
    $max = 5;
    $i = 0;
    
    if( $images ): ?>
          <ul>
            <?php foreach( $images as $image ): $i++; ?>
            <?php if( $i > $max){ break; } ?>
            <li> <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" /> </li>
            <?php endforeach; ?>
          </ul>
          <?php endif; ?>
          <a href="<?php  the_permalink(); ?>" class="info">Gallery</a> </div>
        <?php  endwhile; ?>
    

Comments are closed.