Post Thumbnail error
-
Already I lost a night’s sleep trying to figure out how to bring the result of this code correctly. Must return the feature image. Some kind soul can help?
PS: My code return a default image.
What’s wrong?
if ( is_array($main_articles) ) { foreach($main_articles as $article) { $article = get_post($article); $content.= '<h2 style="font-size:13px"><a>ID) . '" style="text-decoration:none;color:#2D2D25" target="_blank">' . $article->post_title . '</a></h2>'; $thumb_id = get_post_thumbnail_id(); $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full', true); $thumb_url = $thumb_url_array[0]; if ($thumb_url) { $content.= '<span>"' . $thumb_url . '"</span>'; $content.= '<a>ID) . '" target="_blank"><img src="' . $thumb_url->ID . '" width="345"></a>'; } $content.= '<p>' . ptn_shorten_string(strip_tags($article->post_content), 100) . '</p>'; $content.= '<p></p><a href="' . get_permalink($article) . '">Read more</a></p>'; } } return $content;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Post Thumbnail error’ is closed to new replies.