ребят как смотрите создал acf привязал ее к таксономии , что бы в custom taxonomy была возможность добавлять лого ,но теперь когда вывожу оно не определяеться , вот код моего изобретения ,как сделать что бы выводило лого к каждой категории ?
<ul class="services-page__contain">
<?php
$terms_array = array(
'taxonomy' => 'service', // you can change it according to your taxonomy
);
$services_terms = get_terms($terms_array);
foreach ($services_terms as $service): ?>
<li class="services-page-tile">
<?php
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
$image = get_field('icons', $taxonomy . '_' . $term_id);
echo '<img src="' . $image['url'] . '">'; ?>
<img class="services-page-tile__img" src=""
alt="<?php echo $service->name; ?>">
<ul>
<a class="services-page-tile__description" href="">
<p class="services-page-tile__txt"><?php echo $service->name; ?></p>
<?php
$post_args = array(
'posts_per_page' => -1,
'post_type' => 'service', // you can change it according to your custom post type
'tax_query' => array(
array(
'taxonomy' => 'service', // you can change it according to your taxonomy
'field' => 'term_id', // this can be 'term_id', 'slug' & 'name'
'terms' => $service->term_id,
)
)
);
$myposts = get_posts($post_args); ?>
<?php foreach ($myposts as $post) : setup_postdata($post); ?>
<li class="services-page__link"><?php the_title(); ?></li>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</a>
</ul>
</li>
<?php endforeach; // End Term foreach; ?>