Monday 15 February 2010

php - Why my post's thumbnail is not showing up? -


I created a post with the image featured with add a new post Section, and now I want to retrieve the post with thumbnail, summary and title. Other fields are displayed just fine (title and summary) the way I want, although nothing can be obtained for thumbnails, I am using code here:

 < Code> & lt ;? Php $ args = array ('posts_per_page' => 1, 'order' = & gt; 'DEC', 'category' = & gt; clock ',' orderby '= & gt;' post_date ',' offset '= & Gt; 1,); List of posters = get_posts ($ args); Forex Currency ($ post as $ post): setup_postdata ($ post); ? & Gt; & Lt; Td class = "baibambaox" & gt; & Lt ;! - IMAGE - this is a problem - & gt; & Lt; Div class = "img margin" & gt; & Lt ;? Php get_the_post_thumbnail (); ? & Gt; & Lt; / Div & gt; & Lt; Br> & Lt; Div class = "boxScrollsBlogsView" & gt; & Lt; H2 & gt; & Lt ;? Php the_title (); ? & Gt; & Lt; / H2 & gt; & Lt; P & gt; & Lt ;? Php the_excerpt (); ? & Gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; / TD & gt; & Lt ;? Php endforeach; ? & Gt;   

I added this line as function.php

  Add_theme_support ('post thumbnail');   

And when I click on the single-post view, to check whether it has been added to DB or not, I can see the image.

But it's just 'for me to come in a custom page.

I think that you resonance as a return return string. Eg:

  & lt; Div class = "img margin" & gt; & Lt ;? Php echo get_the_post_thumbnail (); ? & Gt; & Lt; / Div & gt;   

Try this:

  & lt; Div class = "img margin" & gt; & Lt ;? Php echo get_the_post_thumbnail ($ post-> ID); ? & Gt; & Lt; / Div & gt;    

No comments:

Post a Comment