Auto Post Thumbnail From First article Image of wordpress

Закрито Опубліковано %project.relative_time Оплачується при отриманні
Закрито Оплачується при отриманні

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

ID Проекту: #7721404

Про проект

5 заявок(-ки) Дистанційний проект Остання активність Jun 28, 2015

5 фрілансерів(-и) готові виконати цю роботу у середньому за $41

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 !! Більше

$55 USD за 1 день
(232 відгуків(и))
7.0
longthanh

A proposal has not yet been provided

$25 USD за 1 день
(11 відгуків(и))
4.2