Support

Account

Home Forums Bug Reports ACF pro dont return custom images sizes in custom taxonomy fields

Unread

ACF pro dont return custom images sizes in custom taxonomy fields

  • I have a custom field for image in a custom taxonomy. I have created custom image files in the functions file. I have regenerated the images. The images now exist. the problem is that I try to show this custom size but the only thing that is shown is the full image. Thumbnail, medium, large and full work perfectly. I have seen in debug mode and only recognizes names of custom sizes but in its strings it only returns the address to the full image and not the customized one. I think it’s a problem, because this also happens in the backend.

    I have tried with another plugin that makes custom fields in taxonomies and it works correctly, it returns the custom sizes and its urls.

    Can someone confirm this error?

    
    <div class="cat-paraguas">
     <?php $args = array(
    	'taxonomy'               => array( 'categorias_paraguas' ),
    	'hide_empty'             => true,
    	'get'                    => 'all',
    );
      foreach ( get_terms($args) as $cat) : ?>
    
     <?php
     $image = get_field('foto_categoria', 'categorias_paraguas_' . $cat->term_id ); 
    
     $url = $image['url'];
            $title = $image['title'];
            $alt = $image['alt'];
         	// which size?
            $size = 'isotopo';
            $thumb = $image['sizes'][ $size ];
    ?>
    
    <?php 
    echo '<pre>';
    	var_dump(  $image );
    echo '</pre>';
    ?>
      
    <figure class="effect-jazz">
    
    <?php if($image): //dont output an empty image tag ?>
    						
     <img src="<?php echo  $thumb; ?>" alt="<?php echo $image['caption']; ?>" />
    <?php endif; ?>
    
    <figcaption>
    
    <h2 class="titulo-memoria-inicio-on"><a href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->name; ?></a></h2>
    <?php echo $cat->description; ?>
    
    <a href="<?php echo get_category_link($cat->term_id); ?>">View more</a>
    
    </figcaption>	
    </figure>
    
     <?php endforeach; ?>
    
    </div>
    
    

    Debug

    I put a dump to see the strings of $ image

    If you change the code with your custom taxonomy and your associated image field and create a custom image size, you can try it. it can be seen that the correct image sizes are not returned in the urls

Viewing 1 post (of 1 total)

The topic ‘ACF pro dont return custom images sizes in custom taxonomy fields’ is closed to new replies.