Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // ARQUIVO PARA OS CUSTOM POST TYPES DO TEMA
- /* CPT DOCUMENTOS */
- add_action( 'init', 'register_cpt_documentos' );
- function register_cpt_documentos() {
- $labels = array(
- 'name' => _x( 'Documentos', 'documentos' ),
- 'singular_name' => _x( 'Documento', 'documentos' ),
- 'add_new' => _x( 'Adicionar Documento', 'documentos' ),
- 'add_new_item' => _x( 'Adicionar Novo Documento', 'documentos' ),
- 'edit_item' => _x( 'Editar Documento', 'documentos' ),
- 'new_item' => _x( 'Novo Documento', 'documentos' ),
- 'view_item' => _x( 'Ver Documento', 'documentos' ),
- 'search_items' => _x( 'Localizar documentos', 'documentos' ),
- 'not_found' => _x( 'Nenhum Documento encontrado', 'documentos' ),
- 'not_found_in_trash' => _x( 'Não há documentos na Lixeira', 'documentos' ),
- 'parent_item_colon' => _x( 'Pai Documento:', 'documentos' ),
- 'menu_name' => _x( 'Documentos de Clientes', 'documentos' ), /* "Documentos de Clientes" será o texto que vai aparecer no menu do painel */
- );
- $args = array(
- 'labels' => $labels,
- 'hierarchical' => true,
- 'supports' => array( 'title', 'author', 'editor', 'comments' ),
- 'taxonomies' => array( 'cliente' ), /* "Cliente" será a taxonomia para o CPT documentos */
- 'public' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'menu_position' => 5,
- 'menu_icon' => 'http://seu-site.com.br/wp-content/themes/seu-tema/images/documentos-icone.gif', /* Crie uma imagem de 16x16 px e salve em seu tema */
- 'show_in_nav_menus' => true,
- 'publicly_queryable' => true,
- 'exclude_from_search' => true,
- 'has_archive' => true,
- 'query_var' => true,
- 'can_export' => true,
- 'rewrite' => true,
- 'capability_type' => 'post'
- );
- register_post_type( 'documentos', $args );
- }
- // T A X O N O M I A S
- /* TAX:CLIENTE - PARA O CPT DOCUMENTOS */
- add_action( 'init', 'register_taxonomy_cliente' );
- function register_taxonomy_cliente() {
- $labels = array(
- 'name' => _x( 'Clientes', 'cliente' ),
- 'singular_name' => _x( 'Cliente', 'cliente' ),
- 'search_items' => _x( 'Localizar Cliente', 'cliente' ),
- 'popular_items' => _x( 'Clientes Populares', 'cliente' ),
- 'all_items' => _x( 'Todos os Clientes', 'cliente' ),
- 'parent_item' => _x( 'Cliente Pai', 'cliente' ),
- 'parent_item_colon' => _x( 'Cliente Pai:', 'cliente' ),
- 'edit_item' => _x( 'Editar Cliente', 'cliente' ),
- 'update_item' => _x( 'Atualizar Cliente', 'cliente' ),
- 'add_new_item' => _x( 'Adicionar Novo Cliente', 'cliente' ),
- 'new_item_name' => _x( 'Novo Nome de Cliente', 'cliente' ),
- 'separate_items_with_commas' => _x( 'Separe por vírgulas', 'cliente' ),
- 'add_or_remove_items' => _x( 'Adicionar ou remover Cliente', 'cliente' ),
- 'choose_from_most_used' => _x( 'Escolha entre os mais usados', 'cliente' ),
- 'menu_name' => _x( 'Clientes', 'cliente' ),
- );
- $args = array(
- 'labels' => $labels,
- 'public' => true,
- 'show_in_nav_menus' => true,
- 'show_ui' => true,
- 'show_tagcloud' => true,
- 'hierarchical' => true,
- 'rewrite' => true,
- 'query_var' => true
- );
- register_taxonomy( 'cliente', array('documentos'), $args );
- }
- /* este código refere-se ao post http://rozanchetta.wordpress.com/2011/10/10/area-de-clientes-no-wordpress-criando-o-cpt/
Advertisement
Add Comment
Please, Sign In to add comment