I made it. I have search in google for solutions and found it.
try to add this on the function.php
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 300, 200, true ); // Normal post thumbnails
add_image_size( 'New-Thumbnail', 300, 200, true ); // Permalink thumbnail size
add_filter('the_content', 'set_featured_image_from_attachment');
function set_featured_image_from_attachment($content) {
global $post;
if (has_post_thumbnail()) {
// display the featured image
} else {
// get & set the featured image
$attachments = get_children(array(
'post_parent' => $post->ID,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order'
));
if ($attachments) {
foreach ($attachments as $attachment) {
set_post_thumbnail($post->ID, $attachment->ID);
break;
}
// display the featured image
}
}
return $content;
}
and after chose any thumbnail size on the plugin and you ‘r ready.
-
This reply was modified 7 years ago by
SonicxXx.