Home › Forums › General Issues › Category Images not displaying › Reply To: Category Images not displaying
I figured it out. Here is my code…
<section>
<?php
$args = array(
'orderby' => 'name',
'order' => 'ASC'
);
$categories = get_categories('child_of=39', $args);
foreach($categories as $category) { ?>
<div class="casino-games">
<?php $image_url=get_field('featured_category_image', $category); ?>
<a href="<?php get_category_link( $category->term_id ) ?>" title="<?php sprintf( __( "View all posts in %s" ), $category->name ) ?>" />
<h3><?php echo $category->name ?></h3>
<img src="<?php echo $image_url ?>" /> </a> </div>
<?php } ?>
<div class="clear"></div>
</section>
it was this part that did the trick for me…
<?php $image_url=get_field('featured_category_image', $category); ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.