• 13-01-2016, 12:14:43
    #10
    yardımcı olabildiysem ne mutlu
  • 13-01-2016, 12:38:19
    #11
    Kimlik doğrulama veya yönetimden onay bekliyor.
    function resim_yukle($url, $pid, $bas = null, $ozelalan = null) {
    		$filename = $bas . '.jpg';
    		$filename = remove_accents( $filename );
    
    		if (function_exists( 'mb_strtolower' )) {
    			$filename = mb_strtolower( $filename, 'UTF-8' );
    		}
    
    		$filename = utf8_uri_encode( $filename );
    		$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 />';
    		}
    
    		$neyim = $upload['file'];
    		$attachment = array( 'guid' => $upload['url'], 'post_mime_type' => $type, 'post_title' => $bas, 'post_content' => '', 'post_type' => 'attachment', 'post_parent' => $pid );
    		require_once(ABSPATH . "wp-admin" . '/includes/image.php');
    		require_once(ABSPATH . "wp-admin" . '/includes/file.php');
    		require_once(ABSPATH . "wp-admin" . '/includes/media.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 );
    		add_post_meta( $pid, '_thumbnail_id', $attach_id, true );
    		$nane = $neyim;
    		return $attach_id.",";
    	}
    kullandığım fonksiyon bu ;

    resimleri for döngüsüne atıyarak gelen resimleri wordpress'e yüklüyorum öncelikle ;

    		for($i=1;$i<count($resim)+1;$i++){
    			$galery .= resim_yukle($resim[$i], $ekle, $baslik);
    			flush();
    		}



    $up['post_content'] = '[gallery ids="'.$galery.'"]';
    ve buda içeriğim geliştirebilirsin.