Home Forums Front-end Issues Get custom taxonomy term image field


Get custom taxonomy term image field

    • Juraj_

    • May 5, 2021 at 12:38 am

    I have loop that displays all terms from custom taxonomy. I also have image field, attached to custom taxonomy. Now, I want to display image in my page template:

    <section id="sluzby" class="section--padding" style="background: #eff1f5;">
        <div class="container">
            <div class="row">
    			$terms = get_terms( array( 'taxonomy' => 'sluzba', 'hide_empty' => false ) );
    			$term_image = get_field( 'tax_image' );
    			foreach ( $terms as $term ) : ?>
    				<div class="col-lg-4 col-md-6">
    					<div class="product product-zoom product--card">
    						<div class="product__thumbnail">
    							<?php //if ( $term_image ) : ?>
    								<img src="<?php echo $term_image['url']; ?>" alt="Služba <?php echo $term->name; ?>">
    							<?php //endif; ?>
    						<div class="product-desc">
    							<h4 class="text-center mb-2"><?php echo $term->name; ?></h4>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.