wordpress - ACF repeater field custom image size output -
i'm trying output custom image size in code:
<?php if(get_field('repeater-field-name')) { ?> <?php foreach (get_field('repeater-field-name') $row) :?> <div class="item" onclick="location.href='<?php print $row['link'] ?>';" style="cursor: pointer;"> <div class="sisseviskaja-title"><h2><?php print $row['title'] ?></h2></div> <div class="sisseviskaja-pilt"><img src="<?php print $row['image'] ?>" alt="" /></div> </div> <?php endforeach; ?> <?php } ?>
i have tried acf tutorial codes i'd keep foreach loop have. i'm no php guru havent got ideas implement it.
can someone, please, me?
here's way acf codes. using array image (which need if want pull out dimensions). i'm not sure if can done way want it.
<?php if (have_rows('project_listings')){ ?> <?php while (have_rows('project_listings')){ the_row(); $link = get_sub_field('link_field'); $title = get_sub_field('title_field'); $image = get_sub_field('image'); //additional vars $size = 'full'; $width = $image['sizes'][ $size . '-width' ]; $height = $image['sizes'][ $size . '-height' ]; ?> <div class="item" onclick="location.href='<?php echo $link ?>';" style="cursor: pointer;"> <div class="sisseviskaja-title"> <h2><?php echo $title ?></h2> </div> <div class="sisseviskaja-pilt"> <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>"/> </div> </div> <?php }; ?> <?php }; ?>
Comments
Post a Comment