How to enable post types on Page Attributes?

How can I have post types shown on Page Attributes? For instance I have a custom post type which is product, and I want show it on Page Attributes alongside with the existing WP post types: page, post.

So I want so have a dropdown options and the user can switch around these post types:

post
page
product

My code in functions.php:

function product_init() {
$args = array(
‘labels’ => array(
‘name’ => __(‘Products’),
‘singular_name’ => __(‘Product’),
‘all_items’ => ‘All Products’
),
‘public’ => true,
‘show_ui’ => true,
‘capability_type’ => ‘page’,
‘hierarchical’ => true,
// ‘rewrite’ => array(‘slug’ => ‘Products’),
‘query_var’ => true,
‘menu_icon’ => ‘dashicons-star-filled’,
‘supports’ => array(
‘title’,
‘editor’,
// ‘excerpt’,
// ‘trackbacks’,
//’custom-fields’,
//’comments’,
‘revisions’,
‘thumbnail’,
‘author’,
‘page-attributes’,
)
);
register_post_type( ‘product’, $args );
}
add_action( ‘init’, ‘product_init’ );

Any ideas?

Read more here:: How to enable post types on Page Attributes?

Leave a Reply

Your email address will not be published. Required fields are marked *