Skip to content

Instantly share code, notes, and snippets.

@fael
Created November 7, 2011 15:55
Show Gist options
  • Save fael/1345338 to your computer and use it in GitHub Desktop.
Save fael/1345338 to your computer and use it in GitHub Desktop.
Exemplo de uso de Custom Types do WordPress
//gerado pelo http://themergency.com/generators/cpt-code-output/?id=8966
add_action( 'init', 'register_cpt_atividade' );
function register_cpt_atividade() {
$labels = array(
'name' => _x( 'Atividades', 'atividade' ),
'singular_name' => _x( 'Atividade', 'atividade' ),
'add_new' => _x( 'Adicionar Atividade', 'atividade' ),
'add_new_item' => _x( 'Cadastrar uma Atividade', 'atividade' ),
'edit_item' => _x( 'Editar Atividade', 'atividade' ),
'new_item' => _x( 'Nova Atividade', 'atividade' ),
'view_item' => _x( 'Detalhes da Atividade', 'atividade' ),
'search_items' => _x( 'Pesquisar Atividades', 'atividade' ),
'not_found' => _x( 'Nenhuma Atividade Cadastrada', 'atividade' ),
'not_found_in_trash' => _x( 'Nenhuma Atividade existente no lixo', 'atividade' ),
'parent_item_colon' => _x( 'Parent Atividade:', 'atividade' ),
'menu_name' => _x( 'Atividades', 'atividade' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'description' => 'asdasd',
'supports' => array( 'title', 'editor', 'custom-fields' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'atividade', $args );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment