Answer the question
In order to leave comments, you need to log in
How to display ACF taxonomy field in WordPress archived posts?
There is a custom post type: Store
There is a custom taxonomy: Metro
There is an additional field for the Metro taxonomy , created through the ACF plugin: Metro Branch
When displaying records on the archive page, it is not possible to display the " Metro Branch " field .
$args = array(
'post_type' => 'magaziny',
);
$products = new WP_Query( $args );
if( $products->have_posts() ) {
while( $products->have_posts() ) {
$products->the_post();
<div id="post-<?php the_ID(); ?>">
<div class="item">
<div class="item-info">
<div class="item-location">
<div class="flex">
<div class="flex item-metro">
<div class="item-location-pointer" style="background: #B6127D;"></div>
<span>
<?php
$metros = get_the_terms( get_the_ID(), 'metro' );
// так как функция вернула массив, то логично будет прокрутить его через foreach()
foreach( $metros as $metro ){
echo $metro->name;
}
?>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question