
Hi,
Hope somebody can help me because I tried everything.
On a website I want to add a picture for te child categories “Diesel motoren” and “Vovkad”. I added Image to Category like this:
https://imgur.com/H1uq3BR
and added pictures to my child categorie.
My code of the website is this:
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="products_page">
<h1>Kies een categorie</h1>
<?php
$categories = get_categories( array(
'orderby' => 'name',
'parent' => 12
) );
foreach ( $categories as $category ) {
if ($category->slug != 'geen-onderdeel-van-een-categorie'){ ?>
<?php $category_link = get_category_link( $category->term_id ); ?>
<a href="<?= $category_link; ?>"><button><?php echo $category->name; ?></button></a>
<?php
foreach($categories as $category):
$image = get_image('category_image', $category);
echo '<img src="'.$image['url'].'" alt="'.$image['alt'].'" />';
endforeach;
?>
<?php }
}//end foreach ?>
</div>
</div>
</div>
</div>
If something isn’t clear, let me know.
GR
get_image()
is not an ACF function
$image = get_field('category_image', $category);