Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Advanced Custom Fields displaying ‘Array’ instead of showing image

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41379
    croydon86
    Participant

    Hi Guys

    I am using the Advanced Custom Fields plugin with the Repeater Field add-on to display a product image, description and price.

    This works fine on most fields, however, when the field type is an image, it just displays the word ‘array’ on the website.

    Here is my code to call the plugin….

    if($rows) {

    foreach($rows as $row)
    {
    echo $row, $row, $row;
    }
    }

    ?>

    and here is what it outputs… http://noteha.co.uk/dev/products/ – The word ‘Array’ is where the image should go.

    These are my admin settings https://dl.dropbox.com/u/94593656/Screen%20Shot%202012-12-16%20at%2014.24.05.png and the image does display on the page admin.

    I can’t think what this could be.

    Any help would be great.

    #117618
    croydon86
    Participant

    Ok figured it out, I had to actually state the img src in my code.

    For any one else that wants to know, the correct code should be this..

    if($rows) {

    foreach($rows as $row)
    {
    echo ‘‘, $row, $row;
    }
    }

    ?>

    #117624
    Watson90
    Member

    I was about to say you have to wrap it in `` but you already figured it out.

    I had the same problem the other week and couldn’t figure it out.

    #117663
    croydon86
    Participant

    yeh it’s a shame they don’t include this on the documentation (unless I missed it) but it truly is a great plug-in and add-on.

    #117738
    SgtLegend
    Member

    @croydon86

    > yeh it’s a shame they don’t include this on the documentation (unless I missed it) but it truly is a great plug-in and add-on.

    This is a standard method of using images within WordPress, pre-wrapping an image with an HTML `` can cause issues because there are instances where we may only want the URL to the image and nothing else.

    While it may not be specified in the plugin docs I have seen somewhere in the WordPress docs that it does only return paths.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.