WordPress中的一个问题,我想在页面上显示有关类别以及它们的图像的信息...我使用ACF插件在类别中添加了图像,显示了所有数据:名称,描述,但是图片不是,这是我的代码,怎么了告诉我?
<?php
$categories = get_categories(array('hide_empty' => 0, 'taxonomy' => 'authors-category'));
foreach ($categories as $cat) {
$id = $cat->cat_ID;
$term = get_queried_object();
$cat_img = get_field('category_image', $cat);
?>
<!--Author-->
<div class="author-block">
<div class="photo-author" style="background: url(<?php echo $cat_img['url']; ?>) #f3b458 no-repeat center center;background-size: cover;"></div>
<div class="name-author"><?php echo $cat->name ?></div>
<div class="count-post-author">
41 post </br>
<a href="#">See All Posts By The Author</a>
</div>
<div class="content-author">
<?php echo $cat->description ?>
</div>
</div>
<!--End Block-->
<?php } ?>
这是发生了什么,只应该在图中代替图片: