Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter JimDestruct

    (@jimdestruct)

    Thanks for the replies, I seem to have actually sorted it now by going into the database and deleting all instances of that page bar the live entry – don’t know why that has worked but it has.

    It would just be a case of doing the following (I assume for the thumnail you are using the ‘file’ form field selector in simple fields):

    <?php $getfields = simple_fields_get_post_group_values(get_the_id(), "Field Group Name", true, 1);
    $count = 0;
        if($getfields["Field1"][0]!="") {
        foreach($getfields["Field1"] as $options) { ?>
    
        <?php $imgsrc = wp_get_attachment_image_src($getfields["Field1"][$count], 'thumbnail'); ?>
            <img src="<?=$imgsrc[0]?>" alt="thumbnail" />
            <h2><?php echo($getfields["Field2"][$count])?></h2>
    	<p><?php echo($getfields["Field3"][$count])?></p>
    
        <?php $count++; }} ?>

    So, all you are doing is looping through your repeatable fields and getting the image src of the thumbnail as well as your <h2> and <p> fields then wrapping them in those tags.

    To get simple fields (repeatable) to appear on a page, I do the following – in the page template add the following where you want the fields to appear:

    <?php $getfields = simple_fields_get_post_group_values(get_the_id(), "Field Group Name", true, 1);
    $count = 0;
        if($getfields["Field1"][0]!="") {
        foreach($getfields["Field1"] as $options) {
    	echo("field 1 is: " . $getfields["Field1"][$count]);
    	echo("field 2 is: " . $getfields["Field2"][$count]);
    	echo("field 3 is: " . $getfields["Field3"][$count]);
        $count++; }} ?>

    [Please post code snippets between backticks or use the code button.]

    Obviously replace “Field Group Name” and “Field1”, “Field2”, “Field3” with the name of the group and fields.

    Hope that helps

Viewing 3 replies - 1 through 3 (of 3 total)