mojtabakhazaeli
پنج شنبه 29 مرداد 1394, 18:31 عصر
سلام من یک تابع دارم که در صورتی که یک پست عکس نداشت میاد و یک عکس با ایدی 683 رو قرار میده
حالا میخوام بعه جای ایدی عکس رو از یک ادرس بخونه چیکار کنم ؟:اشتباه:
این هم کد
function autoset_featured() {
global $post;
$already_has_thumb = has_post_thumbnail($post->ID);
if (!$already_has_thumb) {
set_post_thumbnail($post->ID, '683');
}}//end function
add_action('the_post', 'autoset_featured');
add_action('save_post', 'autoset_featured');
add_action('draft_to_publish', 'autoset_featured');
add_action('new_to_publish', 'autoset_featured');
add_action('pending_to_publish', 'autoset_featured');
add_action('future_to_publish', 'autoset_featured');
حالا میخوام بعه جای ایدی عکس رو از یک ادرس بخونه چیکار کنم ؟:اشتباه:
این هم کد
function autoset_featured() {
global $post;
$already_has_thumb = has_post_thumbnail($post->ID);
if (!$already_has_thumb) {
set_post_thumbnail($post->ID, '683');
}}//end function
add_action('the_post', 'autoset_featured');
add_action('save_post', 'autoset_featured');
add_action('draft_to_publish', 'autoset_featured');
add_action('new_to_publish', 'autoset_featured');
add_action('pending_to_publish', 'autoset_featured');
add_action('future_to_publish', 'autoset_featured');