Support

Account

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

  • What code do you have?

    Maybe I’ve misunderstood.

    This loops categories:

    <?php
    $categories = get_categories( array(
        'orderby' => 'name',
        'order'   => 'ASC'
    ) );
     
    foreach( $categories as $category ) {
        $category_link = sprintf( 
            '<a href="%1$s" alt="%2$s">%3$s</a>',
            esc_url( get_category_link( $category->term_id ) ),
            esc_attr( sprintf( __( 'View all posts in %s', 'textdomain' ), $category->name ) ),
            esc_html( $category->name )
        );
         
        echo '<p>' . sprintf( esc_html__( 'Category: %s', 'textdomain' ), $category_link ) . '</p> ';
        echo '<p>' . sprintf( esc_html__( 'Description: %s', 'textdomain' ), $category->description ) . '</p>';
        echo '<p>' . sprintf( esc_html__( 'Post Count: %s', 'textdomain' ), $category->count ) . '</p>';
    } 

    This loops taxonomies:

    <?php if( $categories = get_terms( array( 'taxonomy' => 'floor4' ) ) ) :
    foreach( $categories as $cat) : 
    	$hover= get_field('hover', 'term_' .$cat->term_id  );?>
    	<?php echo $hover; ?>
    <?php endforeach;      
    endif;
    ?>