Advanced Custom Field not display select correctly
-
I am using Advanced Custom Field in WordPress. I use the_field(‘brand’) to display the value of custom field. In my case, it is called brand. However, when I use select field type, the result displayed twice. Like:
nike:NIKE
adidas:ADIDASI assume one is label, one is value? how can I only show the value in frontend? I read the document, I modified my code, but received undefined error. below is my code, thank you for help:
`$args = array(
‘post_type’ => ‘kosher’,
$current_query[‘taxonomy’] => $taxonomy_term
);$the_query = new WP_Query( $args );
if ( have_posts() ) : while ( $the_query -> have_posts() ) : $the_query -> the_post(); ?>
<?php
$field = get_field_object(‘brand’);
$value = get_field(‘brand’);
$label = $field[‘choices’][ $value ];
?>
<p><b><?php print_r($label); ?></b> <?php the_field(‘key’); ?> <?php the_title(); ?> <?php the_field( ‘description’ ); ?> </p>
<?php endwhile; else: ?>
<p>There are no posts or pages here</p>`
- The topic ‘Advanced Custom Field not display select correctly’ is closed to new replies.