WordPress.org

Support

Support » Plugins and Hacks » Simple Fields » [Resolved] [Plugin: Simple Fields] Getting images in repeatable fields

[Resolved] [Plugin: Simple Fields] Getting images in repeatable fields

  • Hi !
    I thought I was right with this code :

    <?php
    $major_features = simple_fields_values("major_feat_title,major_feat_image,major_feat_link,major_feat_anchor");
        foreach ($major_features as $major_feature) {
            $file_id = simple_fields_value('major_feat_image');
            $image_info = wp_get_attachment_image_src($file_id, "full");
            $image_url = $image_info[0];
            $post_id = simple_fields_value('major_feat_link');
            $post_url = get_permalink($post_id);
            echo "<li style='background-image: url($image_url)'><p>" . $major_feature["major_feat_title"] . "</p><a href='$post_url#" . $major_feature["major_feat_anchor"] . "'>" . __('En savoir plus',superprotobeef2) . "</a></li>";
        }
    ?>

    But I get only the image of the first occurrence repeated for each…

    Thanks for your help !

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Pär Thernström

    @eskapism

    You should have all your info in the variable $major_feature in each loop already, so in the loop you should be able to do:

    $file_id = $major_feature["major_feat_image"];
    $post_id = $major_feature["major_feat_link"];

    That does the trick !!
    Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] [Plugin: Simple Fields] Getting images in repeatable fields’ is closed to new replies.
Skip to toolbar