• Resolved bruzed

    (@bruzed)


    one of my custom fields is to display an image. the upload seems to work fine:

    [Picture]
    type=file
    relation=true
    class=file
    multiple=true

    the code i’m using to display all the other fields is below. this is obviously wrong. please help.


    <?php
    $block = get_post_meta($post->ID, 'Picture');
    foreach(($block) as $blocks) {
    echo $blocks;
    }
    ?>

    thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • i have the same problem,
    i search on the db and in the values
    of the custom fields
    i found that the attachment id is stored on the
    field, but i don’t know how use the id to get the picture
    from the database

    if there is a way to get the picture by id a function to
    get the picture can do the work

    but this part is a mistery for me

    There are several functions in order to display the image. This is an example.

    Template Content

    [thumbnail_id]
    type = file
    relation = true

    In the loop of the theme files like index.php, single.php, etc:

    <?php
    $thumbnail_id = get_post_meta($post->ID, 'thumbnail_id', true);
    echo wp_get_attachment_image($thumbnail_id, 'thumbnail');
    ?>

    I hope this will help you.

    Thread Starter bruzed

    (@bruzed)

    thanks hiroaki that works perfectly!

    Isit possible to get the value from wp_get_attachment_image($thumbnail_id, ‘thumbnail’);

    and save it in a custom field?

    Actually file type only save a number and i need the uri.

    regards

    how to get multiple thumbnails?

    and link them to a large thumbnail.

    I’d also like to know how to get multiple images to display…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Custom Field Template] how do i display the image or file?’ is closed to new replies.