How to resolve Get image from taxonomy term using ACF
Ok, so you might be getting the worth of the sphere, you simply have to set the way it ought to output, like so:
$image = get_field('image', $taxonomy . '_' . $term_id); echo '<img src="'.$image['sizes']['thumbnail'].'" alt="$image['alt']" />';
This assumes that you simply wish to use the thumbnail image measurement. If using a special measurement, change that textual content to the suitable image measurement.
If you wish to return the complete measurement image, use the next code:
$image = get_field('image', $taxonomy . '_' . $term_id); echo '<img src="'.$image['url'].'" alt="$image['alt']" />';
Get image from taxonomy term using ACF
Ok, so you might be getting the worth of the sphere, you simply have to set the way it ought to output, like so:
$image = get_field('image', $taxonomy . '_' . $term_id); echo '<img src="'.$image['sizes']['thumbnail'].'" alt="$image['alt']" />';
This assumes that you simply wish to use the thumbnail image measurement. If using a special measurement, change that textual content to the suitable image measurement.
If you wish to return the complete measurement image, use the next code:
$image = get_field('image', $taxonomy . '_' . $term_id); echo '<img src="'.$image['url'].'" alt="$image['alt']" />';
Ok, so you might be getting the worth of the sphere, you simply have to set the way it ought to output, like so:
$image = get_field('image', $taxonomy . '_' . $term_id);
echo '<img src="'.$image['sizes']['thumbnail'].'" alt="$image['alt']" />';
This assumes that you simply wish to use the thumbnail image measurement. If using a special measurement, change that textual content to the suitable image measurement.
If you wish to return the complete measurement image, use the next code:
$image = get_field('image', $taxonomy . '_' . $term_id);
echo '<img src="'.$image['url'].'" alt="$image['alt']" />';
<?php
$phrases = get_field('best_seller_laptops_pc_category');
if( $phrases ): ?>
<?php foreach( $phrases as $term ):
$thumb_id = get_woocommerce_term_meta( $term->term_id, 'thumbnail_id', true );
$term_img = wp_get_attachment_url( $thumb_id );
?>
<div class="col-lg-6">
<div class="addbox1">
<img alt="" src="https://ittutorialpoint.com/get-image-from-taxonomy-term-using-acf/<?php echo $term_img;?>">
<div class="contain">
<h3>
<?php echo esc_html( $term->title ); ?>
</h3>
<h4><?php echo esc_html( $term->description ); ?></h4>
<a href="<?php echo get_term_link( $term ); ?>">LEARN MORE</a>
<a href="<?php echo get_term_link( $term ); ?>" class="btn">purchase now</a>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
taxonomy.php is a template for a customized taxonomy primarily based on the identical mannequin of archives.php
In this type of template, you need to use the wordpress loop
<?php if ( have_posts() ) : whereas ( have_posts() ) : the_post(); ?>
Them, you’ll be able to move in get_field, the submit ID like that as 2nd parameter:
$image = get_field('image', $post->ID);