Skip to content

Instantly share code, notes, and snippets.

@claudioweb
Last active July 4, 2017 19:07
Show Gist options
  • Save claudioweb/278bcdcbfc9e047e632f6589bf857635 to your computer and use it in GitHub Desktop.
Save claudioweb/278bcdcbfc9e047e632f6589bf857635 to your computer and use it in GitHub Desktop.
O grupo de posts nada mais é que a classificação de tipo de post, exemplo para produtos
<?php
function produtos() {
$args = array(
'labels' => array(
'name' => 'Produtos',
'add_new' => 'Adicionar Produto'
),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'exclude_from_search' => true,
'rewrite' => array( 'slug' => 'produtos' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => true,
'taxonomies' => array('modelos'),
'menu_position' => 2,
'supports' => array(
'title',
'editor',
'tags',
'author',
'revisions',
'excerpt',
'comments',
'page-attributes'
),
'menu_icon' => 'dashicons-cart'
);
register_post_type( 'produtos', $args );
flush_rewrite_rules();
}
add_action( 'init', 'produtos' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment