• 12-10-2012, 02:19:44
    #1
    Üyeliği durduruldu
    Arkadaşlar yapmış oldugum dizi botunu wp uyarlama şansım olabılırmı acaba ılle plugın olarakmı entegrelıcez yoksa ayrı sayfada calıssada olurmu fikir verebılırmısınız yada her temanın yapısı farklımı wp ıle aram pek iyi degıl yorumlarınız için şimdiden teşekkurler

    bot linki : http://blog.ciriboy.com/videobotu
  • 12-10-2012, 02:39:48
    #2
    function wp_resim_ekle($url, $pid, $filename){
    	$link_info = pathinfo($url);
    	$filetype = wp_check_filetype($url);
    	extract($filetype);
    	if (!$type) $type = "";
    	$upload = wp_upload_bits($filename, $filetype, @file_get_contents($url));
    	if (!empty($upload['error']) ) {
    		return "Resim eklenemedi!<br>Hata: ".$upload['error']."<br>";
    		} else {
    		$neyim = $upload['file'];
    		$attachment = array(
    			'guid' => $upload['url'],
    			'post_mime_type' => $type,
    			'post_title' => $link_info['basename'],
    			'post_content' => '',
    			'post_type' => 'attachment',
    			'post_parent' => $pid
    		);
    		require_once ( ABSPATH . 'wp-admin/includes/image.php' );
    		$attach_id = wp_insert_attachment($attachment, $neyim, $pid);
    		$attach_data = wp_generate_attachment_metadata($attach_id, $neyim);
    		wp_update_attachment_metadata($attach_id, $attach_data);
    		return $attach_data;
    	}
    }
    	$my_post = array();
    	$my_post['post_title'] 		= $baslik;
    	$my_post['post_content'] 	= $aciklama;
    	$my_post['tags_input'] 		= $etiket;
    	$my_post['post_status'] 	= $yayin;
    	$my_post['post_author'] 	= 1;
    	$my_post['post_category']	= array($kategori);
    	
    	
    	if ($idxx=wp_insert_post($my_post)) {
    				for($i=0; $i<count($resimler); $i++){
    			$resim	= trim($resimler[$i]);
    			wp_resim_ekle($resim,$idxx,md5(rand().time().microtime().rand()).".jpg");
    		}
    		die('ok');
    	}
    Bu kodlar yardımcı olur belki. kaydet.php için.