Hi All,
This can be done as follows:
Field Type: Taxonomy
Taxonomy: Select your category
Appearance: Select
Return Value: Term Object (not Term ID)
Here’s how to display it on your Theme:
<?php $cat_link_term = get_field( 'my_category_url' ); ?>
<?php if ( $cat_link_term ): ?>
<a href="<?php bloginfo('url'); ?>/<?php echo $cat_link_term->slug; ?>"><?php echo $cat_link_term->name; ?></a>
<?php endif; ?>
Here’s how to us it within a repeater:
<?php while(the_repeater_field('my_category_repeater')) { ?>
<?php $cat_link_term = get_sub_field( 'my_category_url' ); ?>
<?php if ( $cat_link_term ): ?>
<a href="<?php bloginfo('url'); ?>/<?php echo $cat_link_term->slug; ?>"><?php echo $cat_link_term->name; ?></a>
<?php endif; ?>
<?php } ?>
Thanks,
Lee.