• Resolved CarolineElisa

    (@carolineelisa)


    Hi there,

    I am trying the following to display a series of properties:

    <?php $properties = simple_fields_values("name,description,link,image");
        foreach ($properties as $property) {
    	echo "<div class='property'>";
    	$propname = simple_fields_value('name');
    	$propdescription = simple_fields_value('description');
    	$propimageid = simple_fields_value('image');
    	$propimageinfo = wp_get_attachment_image_src($propimageid, "full");
    	$propimageurl = $propimageinfo[0];
    	$proplink = simple_fields_value('link');
    	echo "<a href='$proplink'><img src='$propimageurl'></a>" . "\n";
    	echo "<a href='$proplink'><h3>$propname</h3>" . "\n";
    	echo "$propdescription</a>";
    	echo "</div>";
        }
    ?>

    However the same field values are returned for every entry.

    Hoping someone can help! Thanks.

    http://wordpress.org/plugins/simple-fields/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter CarolineElisa

    (@carolineelisa)

    Actually I got it working like this:

    <?php $properties = simple_fields_values("name,description,link,image");
        foreach ($properties as $property) {
    	echo "<div class='property'>";
    	echo "<a href=" . $property['link'] . "><img src=" . $property['image']['url'] . "></a>" . "\n";
    	echo "<a href=" . $property['link'] . "><h3>" . $property['name'] . "</h3>" . "\n";
    	echo $property['description'] . "</a>";
    	echo "</div>";
        }
    ?>

    Thank you for this post a LOT, Caroline! You saved me hours and hours 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying repeatable field set’ is closed to new replies.