php - How to create custom post types with categories in wordpress with its category? -
how create custom post types in wordpress category
i want create news section in site (same posts), want create own news section having post type news. please make suggestion.
try :
<?php add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'news', array( 'labels' => array( 'name' => __( 'news' ), 'singular_name' => __( 'news' ) ), 'capability_type' => 'post', 'public' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'thumbnail', 'author', 'page-attributes', ) ) ); } register_taxonomy( 'news_category', 'news',array('label' => __( 'categories' ),'rewrite' => array( 'slug' => 'news_category' ),'hierarchical' => true, ) ); ?>
Comments
Post a Comment