Home » Topics » General Support » Images

Images

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1641
    Sion Thomas
    Participant

    Hi,

    Please forgive my ignorance, my programming skills are limited. I’m trying to upload images to a custom widget but get nothing? Text works fine. I have tried a few things including the following code –

    <?php if( get_field(‘accolade_image’ , $acfw) ): ?>

    ” />

    <?php endif; ?>

    and

    <?php

    $image = get_field(‘accolade_image’, , $acfw);
    $size = ‘thumbnail’; // (thumbnail, medium, large, full or custom size)

    if( $image ) {

    echo wp_get_attachment_image( $image, $size );

    }

    ?>

    But no joy. What am I doing wrong?

    #1659
    Daron Spence
    Keymaster

    How are you returning the image? In your field group settings, you can choose if you want the callback to return a URL, an Image Object, or the Attachment ID.

    I would suggest choosing the URL options and then use something like:

    <img src=”<?php the_field(‘accolade_image’, $acfw); ?>” />

    Make sure this is within the correct template that corresponds to your widget. Using the $acfw variable outside those templates won’t return anything.

    #1779
    Daron Spence
    Keymaster

    Marking this as closed. You can reply to re-open it (I think)

    Otherwise, you can start a new thread 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Images’ is closed to new replies.