Calling a custom field in! (Wordpress)

Discussion in 'PHP' started by MafiaPenguin, Sep 4, 2011.

  1. #1
    Hey everyone. What i am trying to do here is simply call in the custom field value of (thumb-nail) in a div for each post where it's listed on the homepage. I cant for the life of me get the custom fields value to display. Have i written it wrong? I'm not to smart with the whole php side of things so i could do with some help.

    
    <?php
    	$args = array( 'numberposts' => '10' );
    $recent_posts = wp_get_recent_posts( $args );
    	foreach( $recent_posts as $recent ){
    echo '<div class="construct-filmlistbox"><div class="construct-filmlistthumbnail">'. get_post_meta($post->ID, 'thumb-nail', true) .'</div><li><a href="'.  get_permalink($recent["ID"])  . '" title="Look '.$recent["post_title"].'" >' .  $recent["post_title"].'</a></li></div> ';
    	}
    ?>
    PHP:
    The website is filmhammer.com. The section this code applies for is the list of posts at the bottom left of the page. The custom field value is an image which will hopefully be displayed in the small white box. A small image of the film.

    Thanks for your time, and if you need any more info of me i'll be happy to provide.
     
    MafiaPenguin, Sep 4, 2011 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    I'd start by putting the get_post_meta into a variable and var_dump-ing that to see what gets collected.

    You are storing the image in the meta, right?
     
    sarahk, Sep 4, 2011 IP