Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to display a thumbnail in a foreach loop. The thumbnail is a new image size I have added called "plant-thumb". I have all the desired elements displaying properly except for the thumbnail. Here is my code:

      foreach ( $posts as $post ) {   

       echo '<a class="modalLink" href="plant-list-accordion'.$post->ID.'" >';
       echo get_the_post_thumbnail($thumbnail->ID, 'plant-thumb'); //Here is where I'm trying to output the bespoke thumbnail
       echo '</a>';

            $faq .= sprintf(('<div class="modal mfp-hide" id="plant-list-accordion'.$post->ID.'">%1$s<div>%2$s</div>'),
                $post->post_title,
                wpautop($post->post_content)
                 );
            $faq .= '</div>'; //Close the container
            }

        return $faq; //Return the HTML.
};
share|improve this question

1 Answer 1

up vote -1 down vote accepted

echo get_the_post_thumbnail($post->ID, 'plant-thumb');

share|improve this answer
1  
Please add an explanation to your answer: why could that solve the problem? –  toscho Jul 25 '13 at 11:28
    
wonderful, thank you –  Ciaran Gaffey Jul 25 '13 at 11:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.