Support » Plugin: Custom Fields Creator » [Plugin: Custom Fields Creator] Image DIsplay

  • Hi,

    Great plugin – but can’t get images to display – I have watched the tutorial but images are not displaying. My code is:

    <div id="quotes"><h3>Quotes</h3>
    			<?php $quotes = get_post_meta( $post->ID, 'quotes', true );
    			foreach( $quotes as $quote){
    			   	echo '<div>';
    				echo '<img src="' . $quote['quotes_pic'] . '" class="alignleft" />';
    				echo '<p>' . $quote['quotes_text'] . '</p>';
    				echo '<p><strong>' . $quote['quotes_author'] . '</strong></p>';
    				echo '</div>';

    but that brings in the attachment ID as the path – what is the right way to get the path and also display a certain size.


Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor madalin.ungureanu



    In version 1.0.2 we changed the upload field from storing the url to the file into storing the attachment ID for the file.

    So now you can use functions like wp_get_attachment_image, wp_get_attachment_image_src or wp_get_attachment_url depending on the desired functionality

    hi is it possible you can state the code/syntax for the function to display the image – wp_get_attachment_image, wp_get_attachment_image_src or wp_get_attachment_url to actually display the link (sorry…. just starting out in php)

    I received your reply via email but is not listed here in WordPress support


    Plugin Contributor madalin.ungureanu


    In case you didn’t get the codex links from my previous answer here they are again:

    They provide a pretty detailed description of the functions and also usage examples. Hope it helps!

    Hi, love your plugin.
    Cant put images working, who do I set the code for wp_get_attachment_image on version 1.0.3? can you explane the code?

    I’m having the same issue. The plugin is great indeed but could you give a full code example of getting the image with version 1.0.3 upwards. If we take a simple use case:

    foreach($items as $item){
    echo ‘<img src=”‘.$item[‘item_pic’].'” />’;

    What would be the code equivalent in the newer version?

    Many thanks.

    Hey Pedromrferreira,

    I’ve been looking into this and i have a solution for you. Please see below. Hopefully this will help others out since the change in the plugin’s way of accessing images. The exampel below is something i’ve worked up which loops through all images in a repeater and outputs both a thumbnail and full size image so you can pick from what you want. If you have other sizes specified in Worpdress you can just replace ‘full’ with your named image size:


    $clientimages = get_post_meta( $post->ID, ‘clients’, true );

    foreach($clientimages as $clientimage){ // For each loop for
    $thumbnail = wp_get_attachment_image_src( $clientimage[‘clientimage’] );
    $full = wp_get_attachment_image_src( $clientimage[‘clientimage’],’full’ );
    echo ‘<img src=”‘ . $thumbnail[0] . ‘” />’;
    echo ‘<img src=”‘ . $full[0] . ‘” />’;


    OK, got it:

    $actividades = get_post_meta( $post->ID, 'actividades', true );
    echo '<ul class="content-act">';
    foreach( $actividades as $actividade){
    echo '
    echo '<h2>' . $actividade['titulo'] . '</h2>';
    $attachment_image = wp_get_attachment_image_src($actividade['imagem'], 'full');
    echo '<img src="'. $attachment_image[0].'" width="<'. $attachment_image[1] .'" height="'. $attachment_image[2] .'"/>';
    echo '<p>' . $actividade['descricao'] . '</p>';
    echo '</li>
    echo '';

    Use This: Had same problem… It worked for me…

    $result = wp_get_attachment_image_src($addbooks['book-image']);
    $url = $result[0];
    echo '<img src="'. $url.'" >';

    ‘$addbooks’ : name of metabox.
    ‘book-image’ : name of image field.
    It will show image in thumbnail for showing full image. USe:
    $result = wp_get_attachment_image_src($addbooks['book-image'],'full');

    Hope it will help you…
    Happy Coding…!!! -TK

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Custom Fields Creator] Image DIsplay’ is closed to new replies.