• charleyramm

    (@charleyramm)


    Hi,
    I want to use The Loop to get the first thumbnail from some pages. Right now I am using a custom field ‘picture’ with the thumbnail url.

    Is there a way to get the first picture associated with a page? It should also be the ‘thumbnail’ version.

    http://moatfarm.org/movingartseast.org.uk

    Right now I have this:

    <?php $args = array(
            'order'=>ASC,
          	'post_type' => 'page', // Only get pages
            'post_parent' => 2 // Get pages that are children of page 2.
            ); query_posts($args); ?>   
    
    <?php while (have_posts()) : the_post(); ?>
    <img src="<?php
       // Get url from custom field 'picture'
       $key="picture";
       echo get_post_meta($post->ID, $key, true);
    ?>" />
    
    <?php endwhile;?>

    Any help sincerely appreciated. I have done as much as I know how and now I need some help.

    Charley

  • The topic ‘Get a thumbnail from pages with The Loop’ is closed to new replies.