insert thumbnail image from php script

Question

I’m trying to insert a post image thumbnail from my php scritp. It’s inserting the post, the content, a download link, and I only need to set the thumbnail image to finish my script. This is my code but I can’t figure out why is not working, anyhelp would be appreciated:

    $url = "http://www.test.com/wp-content/uploads/2015/12/".$title[$key1].".png";

$attr = array(
'src'   => basename($url),
'class' => "alignleft",
'alt'   => '',
'title' => trim( strip_tags( 'Logo' ) )
);
the_post_thumbnail('thumbnail', $attr );
0
, , , , Alfro 4 years 2020-05-28T02:10:22-05:00 0 Answers 90 views 0

Leave an answer

Browse
Browse