Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Custom Post Type
- add_action('init', 'post_type_produto');
- // Custom Taxonomy
- add_action( 'init', 'create_custom_tax_tipo' );
- function post_type_produto(){
- register_post_type('produtos',
- array(
- 'labels' => array(
- 'name' => _('Produtos'),
- 'singular_name' => _('Produto'),
- ),
- 'public' => true,
- 'has_archive' => true,
- 'show_ui' => true,
- 'menu_icon' => 'dashicons-images-alt',
- 'supports' => array('title','thumbnail'),
- 'menu_position'=> 5,
- )
- );
- }
- /* Método para o registro da Custom Taxonomy Tipo de Produto */
- function create_custom_tax_tipo(){
- $custom_tax_nome = 'tipo_de_produto';
- $custom_post_type_nome = 'produtos';
- $args = array(
- 'label' => __('Tipo de Produto'),
- 'hierarchical' => true,
- 'rewrite' => array('slug' => 'tipo')
- );
- register_taxonomy( $custom_tax_nome, $custom_post_type_nome, $args );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement