Auto Post Thumbnail From First article Image of wordpress

Closed Posted May 22, 2015 Paid on delivery
Closed Paid on delivery

Sir,

I have a newly bought theme, when i installed it in my site, it keep showing default thumbnail for all my old articles which is about 2000 in number. Though, the theme developer integrated auto post first image from article as thumbnail but it seems is not working properly even when new article is published with image in the post, is still not auto display it as thumbnail except i manually select image for feature image. I don't want use plugin for this work since is already embedded in the theme.

The following codes are the one used in the theme's [login to view URL] file:

// Get image attachment (sizes: thumbnail, medium, full)

function themeloy_get_thumbnail($postid=0, $size='full') {

if ($postid<1)

$postid = get_the_ID();

$thumb = '';

if(version_compare(get_bloginfo('version'), '2.9') >= 0) {

if(!$thumb && has_post_thumbnail($postid) && function_exists( 'the_post_thumbnail' ) ) {

$post_thumbnail_id = get_post_thumbnail_id( $postid );

$image = wp_get_attachment_image_src( $post_thumbnail_id, $size );

$thumb = $image[0];

}

}

if ($thumb != null or $thumb != '') {

return $thumb;

} elseif ($images = get_children(array(

'post_parent' => $postid,

'post_type' => 'attachment',

'numberposts' => '1',

'post_mime_type' => 'image', ))) {

foreach($images as $image) {

$thumbnail=wp_get_attachment_image_src($image->ID, $size);

return $thumbnail[0];

}

}

}

While the bellow codes are also use in the [login to view URL], [login to view URL] and other widgets that display thumnail like [login to view URL], [login to view URL] etc:

<?php if (have_posts()){ while (have_posts()){ the_post();

$thumb = get_post_thumbnail_id(get_the_ID());

if (!$thumb) {

$url[0] = get_template_directory_uri() . '/img/demo/[login to view URL]';

}else{

$url = wp_get_attachment_image_src( $thumb , '415x260');

}

?>

Please, how much does it cost to correct this without plugin. Or Any suggestion?

This is the link to the theme: [login to view URL]

This is how it appears in my site: [login to view URL]

CSS HTML PHP WordPress

Project ID: #7721404

About the project

5 proposals Remote project Active Jun 28, 2015

5 freelancers are bidding on average $41 for this job

VnBestSolutions

Dear Sir. We claim to get it done perfectly for you EXACTLY in the way you want it - Kindly give we a chance and we will prove myself - Ready to prove our words, let's get it done right away and I mean RIGHT AWAY !! More

$55 USD in 1 day
(232 Reviews)
7.0
longthanh

A proposal has not yet been provided

$25 USD in 1 day
(11 Reviews)
4.2