Support

Account

Home Forums General Issues Field value + label

Unread

Field value + label

  • hello i create a checkbox field with value and label
    like this rouge : 01 Rouge
    rouge is the value to load an image

    <?php
    $values = get_field('motif_tissu');
    if($values)
    {
    	echo '<h5>Tissu</h5><ul class="tissu">';
    	foreach($values as $value)
    	{
    		echo '<li><img src="../images-carac/tissu/' . $value . '.jpg" alt="' . $value . '"><br/><span class="list_figure">' . $value . '</span></li>';
    	}
    	echo '</ul>';
    }
    ?>

    i try the object loading like this but doesn’t works ..

    
    <?php
    $values = get_field_object('motif_tissu');
    if($values)
    {
    	echo '<h5>Tissu</h5><ul class="tissu">';
    	foreach($values as $value)
    	{
    		echo '<li><img src="../images-carac/tissu/' . $value->value . '.jpg" alt="' . $value->label . '"><br/><span class="list_figure">' . $value->label . '</span></li>';
    	}
    	echo '</ul>';
    }
    ?>

    thanks for any help

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.