Nesil Kutu Harf
Labs WP Tricks

Custom Post Type Nasıl Oluşturulur?

Merhaba, Wordpress bizlere “yazılar” sekmesini sunar yazı ekleyip paylaşmak için. Peki ya yazı değil de durum paylaşmak isteyip bu “durumlar” ı yazılar altında listelemeyip ayrı sekmede daha düzenli, ona has…

Me
Hakkı Cengiz ☙ 1 dk okuma süresi
☙ 28 Eyl 2020 ☙ 401

Merhaba,
Wordpress bizlere "yazılar" sekmesini sunar yazı ekleyip paylaşmak için. Peki ya yazı değil de durum paylaşmak isteyip bu "durumlar" ı yazılar altında listelemeyip ayrı sekmede daha düzenli, ona has single.php, archive.php ve özel araçlar istersek? İşte burada devreye Custom Post Type (CPT) girer.

  1. CPT
    
        // #3 Post Type: Duyurular
        function func_duyurular()
        {
            $labels = array(
                'name' => 'Duyurular',
                'singular_name' => 'Duyurular',
                'menu_name' => 'Duyurular',
                'name_admin_bar' => 'Duyurular',
                'archives' => 'Arşivler',
                'attributes' => 'Duyurular Attributes',
                'parent_item_colon' => 'Alt İşlem',
                'all_items' => 'Duyurular',
                'add_new_item' => 'Yeni Duyuru Ekle',
                'add_new' => 'Yeni Ekle',
                'new_item' => 'Yeni Duyuru Ekle',
                'edit_item' => 'Duyuruyu Düzenle',
                'update_item' => 'Duyuruyu Güncelle',
                'view_item' => 'Duyuruyu Göster',
                'view_items' => 'Duyuruları Göster',
                'search_items' => 'Duyuru Ara',
                'not_found' => 'Bulunamadı',
                'not_found_in_trash' => 'Duyuru Çöpte de Yok',
                'featured_image' => 'Öne Çıkan Görsel',
                'set_featured_image' => 'Öne Çıkan Görsel Ayarla',
                'remove_featured_image' => 'Öne Çıkan Görseli Sil',
                'use_featured_image' => 'Öne Çıkan Görsel Belirle',
                'insert_into_item' => 'Duyurulara Ekle',
                'uploaded_to_this_item' => 'Bu duyuru güncellendi',
                'items_list' => 'Duyurular listesi',
                'items_list_navigation' => 'Duyurular listesi menu',
                'filter_items_list' => 'Duyurular listesi filtre',
            );
            $args = array(
                'label' => 'Satın Alma İşlemi',
                'description' => 'Satın Alma İşlemleri, Raporlar',
                'labels' => $labels,
                'supports' => array('title', 'editor', 'thumbnail','page-attributes'),
                'taxonomies' => array('category', 'post_tag'),
                'hierarchical' => false,
                'public' => true,
                'show_ui' => true,
                'show_in_menu' => 'front-sections',
                'menu_position' => 5,
                'menu_icon' => 'dashicons-list-view',
                'show_in_admin_bar' => false,
                'show_in_nav_menus' => true,
                'can_export' => true,
                'has_archive' => false,
                'exclude_from_search' => true,
                'publicly_queryable' => true,
                'capability_type' => 'post',
            );
            register_post_type('duyurular', $args);
        }
        add_action('init', 'func_duyurular', 0);
    
Paylaş:
0 0 votes
Article Rating
Subscribe
Bildir
guest

1 Yorum
Eskiler
En Yeniler Beğenilenler
Inline Feedbacks
View all comments
trackback

[…] Bir Custom Post Type oluşturun […]

  • Panel 1
  • Panel 2
  • Panel 3
  • Panel 4
Welcome!
1
0
Would love your thoughts, please comment.x