2012-02-10 15 views
6

wordpress içinde ayrı kategorilere sahip özel posta tipi oluşturmanın herhangi bir yolu var mı?Posta tipleri için ayrı kategoriler

Örnek:

Mesaj türü "Haber" kategoriler "Dünya" ve "Yerel" olmalıdır. Mesaj türü "Ürünler" categories olmalıdır: "Yazılım" ve "donanım" ve ben "Yazılım" kategorisini için "Haber" post tipi belirleme olanağına sahip olmak istemiyoruz.

Bunu halletmenin bir yolu var mı?

+0

Düzenleyicilerinize güvenmek için gerçekten bu ayrıntı düzeyine mi ihtiyacınız var? – thenetimp

cevap

12

Sen örnek kod izleyerek özel yazı alanı oluşturabilirsiniz:

function ts_post_type_test() { 
    register_post_type('Test', 
       array( 
       'label' => __('Test'), 
       'public' => true, 
       'show_ui' => true, 
       'show_in_nav_menus' => false, 
       'menu_position' => 5, 
       'capability_type' => 'post', 
       'texonomies' => array('category'), 
       'supports' => array('title','editor','thumbnail'), 
       ) 
    ); 
} 

wordpress sitesi linki: http://codex.wordpress.org/Function_Reference/register_post_type

yayının kullanım için oluşturun ayrı kategori için linke aşağıdaki:

http://codex.wordpress.org/Function_Reference/register_taxonomy

Örnek kod:

register_taxonomy('name of taxonomy', 'post name',array("hierarchical" => true,"label" => "Label Category","singular_label" => "label of taxonomy",'update_count_callback' => '_update_post_term_count','query_var' => true,'rewrite' => array('slug' => 'slug name of new registered taxonomy', 'with_front' => false),'public' => true,'show_ui' => true,'show_tagcloud' => true,'_builtin' => false,'show_in_nav_menus' => false));