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.

For some reason the following isn't loaded anymore in wordpress 3.5. Does anyone know how to fix the get_the_post_thumbnail() ?

I'm using the follow code:

echo "<div class='meta_apps'>";
echo "<a href='"; the_permalink(); echo "'>";
echo "<div class=\"meta-icon\">".get_the_post_thumbnail($post->post_id, 'thumbnail', $attr)."</div>";
echo "<div class=\"meta-title\">".$post->post_title."</div>";
echo "</a>";
echo "</div>";
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

I could be mistaken, but I don't think $post->post_id works to retrieve the post's ID. I believe you want $post->ID. So that was probably your issue to begin with, though without seeing your $attr array, it's hard to say. Here's a reference for $post's properties. In this case, get_the_post_thumbnail is the more appropriate function.

In your answer you posted for yourself, you're using the_post_thumbnail incorrectly. First off, you don't need to echo it; the_post_thumbnail will output the thumbnail. Side note: Any function in WordPress that starts with the_ is almost always going to output something automatically. Second, You don't need to pass it $post->ID (again, using the wrong property). Third, the first property of the_post_thumbnail is the size, e.g. "thumbnail".

share|improve this answer
    
Thanks matthew, i'm not a programmer so these kind of basic stuff makes my head spin sometime. Thanks for your answer, it helps alot! –  rwzdoorn Dec 13 '12 at 10:13
add comment

Problem solved,

                echo the_post_thumbnail($post->post_id, array('class' => 'meta_icon')); echo "</div>";

Don't use 'get_the_thumbnail' but simply use the_post_thumbnail.

share|improve this answer
    
An echo is not required here, the the_post_thumbnail function already echos the image. codex.wordpress.org/Function_Reference/the_post_thumbnail –  Jason Dec 14 '12 at 11:36
add comment

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.