Arkadaşlar basit bir bot yapıyorum kendim kullanmam için.
Botta resmi kendi sunucuma alıyorum adresimde belli.
Fakat ben bu resmi Post'a nasıl öne çıkarılmış olarak ekletebilirim, özel alana ekletebiliyorum fakat öne çıkartamıyorum.
Yardımm :/ Bottan Resmi Öne Çıkarılmış Olarak Ekletme
4
●252
- 13-11-2016, 19:44:34
- 13-11-2016, 20:40:57Reklam67 adlı üyeden alıntı: mesajı görüntüle
function insert_image2post( $postid, $image, $featured = false ) { global $wpdb; $post_title = $wpdb->get_var("SELECT $wpdb->posts.post_title FROM $wpdb->posts WHERE ID = '$postid'"); if( is_null( $post_title ) ) return false; $post_name = sanitize_title( $post_title ); if( !class_exists( 'WP_Http' ) ) include_once( ABSPATH . WPINC. '/class-http.php' ); $photo = new WP_Http(); $photo = $photo->request($image); if( $photo['response']['code'] != 200 ) return false; $attachment = wp_upload_bits( $post_name . '.jpg', null, $photo['body'], date("Y/m") ); if( !empty( $attachment['error'] ) ) return false; $filetype = wp_check_filetype( basename( $attachment['file'] ), null ); $postinfo = array( 'post_mime_type' => $filetype['type'], 'post_title' => $post_title, 'post_content' => '', 'post_excerpt' => '', 'post_status' => 'inherit' ); $filename = $attachment['file']; $attach_id = wp_insert_attachment( $postinfo, $filename, $postid ); if( !function_exists( 'wp_generate_attachment_data' ) ) require_once(ABSPATH . "wp-admin" . '/includes/image.php'); $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data ); if( $featured ) add_post_meta($postid, '_thumbnail_id', $attach_id); return array($attach_id, $attachment['url']); } - 13-11-2016, 21:18:04Hocam yapamadım bu şekilde, elimde post ID ve resim linki var kendi sunucuma eklenmiş olarak ama beceremedimcodeofali adlı üyeden alıntı: mesajı görüntüle
- 13-11-2016, 21:21:40skype: oktayozge ( ekledikten sonra pm atın lütfen )Reklam67 adlı üyeden alıntı: mesajı görüntüle