Sercans
www.sercansevincer.com.tr
Kullanıcı
-
Üyelik
26.01.2017
-
Yaş/Cinsiyet
31 / E
-
Meslek
Wordpress Developer
-
Konum
İstanbul Avrupa
-
Ad Soyad
S** S**
-
Mesajlar
330
-
Beğeniler
100 / 63
-
Ticaret
0, (%0)
Merhaba arkadaşlar
Web sitem üzerinde kullanıcılara yazı girişi yaptırabiliyorum. Burada istediğim konu tam olarak şu kategori seçtirirken kullanıcıya sadece benim istediğim kategorileri görmesini bir türlü sağlayamadım?
Bir fikri düşüncesi olan varsa paylaşabilir mi?
wpuzman
WordPress Developer
Kullanıcı
-
Üyelik
13.01.2017
-
Yaş/Cinsiyet
33 / E
-
Meslek
Yazılım
-
Konum
Trabzon
-
Ad Soyad
B** M**
-
Mesajlar
2771
-
Beğeniler
293 / 949
-
Ticaret
33, (%100)
Yazı girişini eklenti ile mi yaptırıyorsunuz? Yoksa kendiniz mi yaptınız?
wpuzman
WordPress Developer
Kullanıcı
-
Üyelik
13.01.2017
-
Yaş/Cinsiyet
33 / E
-
Meslek
Yazılım
-
Konum
Trabzon
-
Ad Soyad
B** M**
-
Mesajlar
2771
-
Beğeniler
293 / 949
-
Ticaret
33, (%100)
O zaman kategorileri çağırdığınız kodu atın. Düzeltelim.
Sercans
www.sercansevincer.com.tr
Kullanıcı
-
Üyelik
26.01.2017
-
Yaş/Cinsiyet
31 / E
-
Meslek
Wordpress Developer
-
Konum
İstanbul Avrupa
-
Ad Soyad
S** S**
-
Mesajlar
330
-
Beğeniler
100 / 63
-
Ticaret
0, (%0)
/*
Template Name: Profil
*/
?>
foreach ( $kategoriler as $kategori ) {
$kat[] = $kategori;
}
$args = array(
'post_title' => $_POST["baslik"],
'post_content' => $_POST["textarea"],
'post_status' => 'draft',
'post_type' => "post",
'post_category' => $kat
);
$new_post = wp_insert_post( $args );
if (
isset( $_POST['my_image_upload_nonce'] )
&& wp_verify_nonce( $_POST['my_image_upload_nonce'], 'my_image_upload' )
&& current_user_can( 'edit_post', $new_post )
) {
// The nonce was valid and the user has the capabilities, it is safe to continue.
// These files need to be included as dependencies when on the front end.
require_once( ABSPATH . 'wp-admin/includes/image.php' );
require_once( ABSPATH . 'wp-admin/includes/file.php' );
require_once( ABSPATH . 'wp-admin/includes/media.php' );
// Let WordPress handle the upload.
// Remember, 'my_image_upload' is the name of our file input in our form above.
$attachment_id = media_handle_upload( 'my_image_upload', $new_post );
set_post_thumbnail( $new_post, $attachment_id );
if ( is_wp_error( $attachment_id ) ) {
// There was an error uploading the image.
} else {
// The image was uploaded successfully!
}
} else {
// The security check failed, maybe show the user an error.
}
?>