Support

Account

Home Forums Front-end Issues Pull taxonomy name etc. through repeater

Helping

Pull taxonomy name etc. through repeater

  • I’ve created a repeater called categories and inside have a field called category which pulls through the Woocommerce categories.

    I’ve used the normal repeater;

    <?php if( have_rows('categories') ): ?> 
        <?php while( have_rows('categories') ): the_row(); 
            $term = get_sub_field('category');
        ?> 
            <h5><?php echo $term; ?></h5>
    
         	<h4>Term Name: <?php echo esc_html( $term->name ); ?></h4>
    
         	<?php echo $term->name; ?>
    
        <?php endwhile; ?>        
    <?php endif; ?> 
    <?php wp_reset_query(); ?>

    But nothing seems to appear aside from the term ID which I can’t then seem to use at all for the title etc. <?php echo get_the_title($term); ?>

  • Hi!

    If you have the ID for the term, you could do this to get the name of the term:

    $termName = get_term( $termID )->name;

    The function get_term(); returns an object for the term.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Pull taxonomy name etc. through repeater’ is closed to new replies.