Simple Fields
Repeatable image fields (1 post)

  1. cokeyblokey
    Posted 3 years ago #

    Hi Par,

    I'm trying to get repeatable image fields working. I have 4 repeatable fields - 3x text, 1x image. I can get the text fields to display without issue, but the image just won't display - the src is always blank.

    Code i'm using is:

    $repeatable_field_values = simple_fields_values("project_name,project_description,project_image,project_image_alt");
      foreach ($repeatable_field_values as $values) {
    $image_url = wp_get_attachment_image_src( $values );
      echo '<div class="grid_13 alpha omega">
    <div class="grid_10 alpha">
    <h3 class="green_li_subtitle">' . $values["project_name"] . '</h3>
    <div class="no_top_margin">' . $values["project_description"] . '</div>
    <div class="grid3 alpha"><img src="' . $image_url . '"  alt="' . $values["project_image_alt"] . '" style="margin-bottom:5px;"></div>

    As I said, the img src is always returned blank. The slug for the image is 'project_image'.

    I have seen another post (on your simple fields site) where you say:

    ah, you have all you need there
    this should do the trick:
    to output the url to the image just write:

    echo $values["image"]["thumbnail"];

    to output the thumnail version of the image

    But I'm not really sure where this should go in my code - I've tried and tried and tried!

    I've added var_dump($values); inside the loop and it displays all the possible images for each instance.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.