Last active
March 16, 2020 11:42
-
-
Save CesarBalzer/3242ccfbdfa822acf25beb43fcb209ee to your computer and use it in GitHub Desktop.
Example create custom post type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function new_cpt_service() { | |
$labels = array( | |
'name' => _x( 'Servicos', 'api' ), | |
'singular_name' => _x( 'Serviço', 'api' ), | |
'add_new' => _x( 'Adicionar novo', 'api' ), | |
'add_new_item' => __( 'Novo serviço', 'api' ), | |
'edit_item' => __( 'Editar serviço', 'api' ), | |
'new_item' => __( 'Novo serviço', 'api' ), | |
'all_items' => __( 'Todos os serviços', 'api' ), | |
'view_item' => __( 'Visualizar serviço', 'api' ), | |
'search_items' => __( 'Pesquisar serviços', 'api' ), | |
'not_found' => __( 'Nenhum serviço encontrado', 'api' ), | |
'not_found_in_trash' => __( 'Nenhum serviço encontrado no lixo', 'api' ), | |
'parent_item_colon' => '', | |
'menu_name' => 'Serviços' | |
); | |
$args = array( | |
'labels' => $labels, | |
'public' => true, | |
'publicly_queryable' => false, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'show_in_admin_bar' => false, | |
'show_in_nav_menus' => false, | |
// 'show_in_rest' => true, | |
'query_var' => true, | |
'rewrite' => array( 'slug' => 'services' ), | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => false, | |
'menu_position' => 901, | |
'supports' => array( 'title', 'editor', 'author' ), | |
'register_meta_box_cb' => array( $this->SERVICE, 'add_custom_box_service' ) | |
); | |
register_post_type( 'service', $args ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment