Home › Forums › Front-end Issues › Custom taxonomy acf value in loop on other pages › Reply To: Custom taxonomy acf value in loop on other pages
Can you show your code please?
And to clarify, the taxonomy is called floor4
This is linked to a CPT of flat4
The ACF field is called hover and it’s this value you’re trying to get?
Does this work:
global $wp_query;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => -1,
'post_type' => 'flat4',
'paged' => $paged,
'fields' => 'ids'
);
$wp_query = new WP_Query($args);
if ($wp_query->have_posts()) :
while ($wp_query->have_posts()) : $wp_query->the_post();
$taxonomies = get_terms( array(
'taxonomy' => 'floor4',
'hide_empty' => false
) );
if ( !empty($taxonomies) ) :
foreach( $taxonomies as $category ) {
$hover= get_field('hover', 'term_' .$category->term_id );
echo $hover;
}
endif;
endwhile;
endif; wp_reset_query();
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!
🚀 ACF & ACF PRO 6.0.7 are now available.
— Advanced Custom Fields (@wp_acf) January 18, 2023
✨This release contains bug fixes and improvements while we continue to work on the next major release of ACF.https://t.co/wQgAOpwmUI
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.