php - Return custom image size in ACF -


good evening,

i working on wordpress site uses acf (advanced custom fields) display custom slider gallery. problem is, can't seem display custom image sizes within slider.

in acf field type being used content -> gallery, using following code within theme files:

<?php     $images = get_field( 'slider' );     $size = "archive-slider";     if( ! empty( $images ) ) : ?>  <ul class="rslides">     <?php         foreach( $images $key => $value )         {           echo '<li><img src="' . $value['url'] . '" /></li>';         }     ?> </ul>  <?php endif; ?> 

i have defined custom image size in functions file , regenerated thumbnails can't size attribute work. can kindly me?

update:

i updated code (this works):

<li>     <img src="<?php echo $image['sizes']['archive-slider']; ?>" alt="<?php echo $image['alt']; ?>" /> </li> 

per http://www.advancedcustomfields.com/resources/gallery/

you should able access custom image size via $value['sizes']['custom-image-size']


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -