Support

Account

Home Forums ACF PRO Order taxonomy by repeater field

Solved

Order taxonomy by repeater field

  • Hello i have a repeater field called mdb_artist and one sub field mdb_artist_field (Taxonomy type)

    I want to echo this in my post with repeater field order…

    This code give the taxonomy with link but it doesn’t change the order as i want…
    <?php the_terms( $post->ID, 'mdb_artist', '', ' & ', ' ' ); ?>

    This code give the order that i want BUT it doesn’t give me the value and link of taxonomy

    <?php if( have_rows('mdb_artist') ): ?>
    	<?php while( have_rows('mdb_artist') ): the_row(); ?>
    		<?php the_sub_field('mdb_artist_field'); ?>
    	<?php endwhile; ?>
    <?php endif; ?>

    Sub field settings
    Appearance = Check Box
    Create Terms = Yes
    Save Terms = Yes
    Load Terms = No
    Return Value = Term ID (When i use Term Object give me null)

  • I finally found it:

    
    <?php if( have_rows('mdb_artist') ): ?>
    	<?php while( have_rows('mdb_artist') ): the_row();
    		$content = get_sub_field('mdb_artist_field');
    	?>
    		<a href="<?php echo get_term_link( $content[0]->term_id ); ?>"><?php echo $content[0]->name; ?></a>
    <br>
    	<?php endwhile; ?>
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Order taxonomy by repeater field’ is closed to new replies.