i have created custom post type project , want add custom post type page attribute. have done following code:
function register_pt_boutique() { register_post_type('boutique', array( 'label' => 'boutiques', 'description' => 'this post type represents featured items on homepage.', 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'capability_type' => 'post', 'map_meta_cap' => true, 'hierarchical' => true, // 'rewrite' => array('slug' => 'featured', 'hierarchical' => true, 'with_front' => false), 'query_var' => true, 'has_archive' => true, 'menu_position' => '7', 'supports' => array('title', 'page-attributes','thumbnail'), // 'taxonomies' => array('page-attributes'), 'labels' => array( 'name' => 'boutiques', 'singular_name' => 'boutique', 'menu_name' => 'boutiques', 'add_new' => 'add boutique', 'add_new_item' => 'add new boutique', 'edit' => 'edit', 'edit_item' => 'edit boutique', 'new_item' => 'new boutique', 'view' => 'view boutique', 'view_item' => 'view boutique', 'search_items' => 'search boutique', 'not_found' => 'no boutique', 'not_found_in_trash' => 'no boutique found in trash', 'parent' => 'parent boutique', ) )); }
using code page attribute option come 2 fields ("parent" , "order") @ admin side without "template" field option. want page attribute "template" field.
from wordpress 4.7 can include field "template" directly de file https://make.wordpress.org/core/2016/11/03/post-type-templates-in-4-7/
Comments
Post a Comment