خوب بعد از یک مدت تونستم سایت را بروز رسانی کنم
کار این کد این هست که اولین عکس را در پست به عنوان تصویر شاخص قرار میدهد
با استفاده از این روش شما میتونید با قرار دادن این کد در فایل functions.php قالبتون این امکان را اضافه نمایید
اینم کد برای استفاده :
<?php function set_featured_image_for_posts() { // Get all posts so set higher number, // you can increase to any number if you have big amount of posts $args = array( 'numberposts' => 5000); // all posts $all_posts = get_posts( $args ); foreach($all_posts as $k=>$v) { $args = array( 'numberposts' => 1, 'order'=> 'ASC', 'post_mime_type' => 'image', 'post_parent' => $v->ID, 'post_type' => 'attachment' ); // Get attachments $attachments = get_children( $args ); $i=0; foreach($attachments as $attach) { // Get only first image if($i==0) $attachmentsid = $attach->ID; $i++; } // Set Featured image set_post_thumbnail($v->ID,$attachmentsid); } } ?>
شاد و خرم باشید