Home Forums Front-end Issues ACF Select not returning value


ACF Select not returning value

  • Hello.
    I have a repeater field with a select sub field.
    I have 4 options in select field with value and label, and value returned both
    I use this code to retrieve value and label. I want to use label as a title and value to get an image related to that title.
    But i only get the label, not the value

        // check if the repeater field has rows of data
        if( have_rows('servicii_home') ):
            // loop through the rows of data
            while ( have_rows('servicii_home') ) : the_row();?>
            <div class="servHome">
    			$serviciu = get_sub_field('denumire_serviciu');
                    <img class="titleIcon" src="<?php bloginfo( 'template_directory' ); ?>/images/<?php echo $serviciu['value']; ?>.png" />
                    <?php echo $serviciu['label']; ?>
                <a class="butonul btnBlue">Detalii & tarife</a>
                <div class="servCover"></div>
                <img class="servBg" src="<?php bloginfo( 'template_directory' ); ?>/images/coafor.jpg" />
        else :
            // no rows found
  • Hi @organu

    Thanks for the post.

    There must be a mistake in your logic.

    What is the result from debugging the sub_feld like so:

     <div class="servHome">
    			$serviciu = get_sub_field('denumire_serviciu');

    I am looking forward to your respions

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

The topic ‘ACF Select not returning value’ is closed to new replies.