Skip to content

Instantly share code, notes, and snippets.

@quagliato
Created August 5, 2013 14:21
Show Gist options
  • Save quagliato/6156280 to your computer and use it in GitHub Desktop.
Save quagliato/6156280 to your computer and use it in GitHub Desktop.
Create a new post-type
// Dentro do functions.php no diretório do tema, adicione o seguinte código:
/*
* Post Type: NOME
*/
add_action('init', 'post_type_register');
function post_type_register() {
$labels = array(
'name' => _x('NOME', 'post type general name'),
'singular_name' => _x('NOME_SINGULAR', 'post type singular name'),
'add_new' => _x('Adicionar Novo', 'nome_do_post_type'),
'add_new_item' => __('Adicionar Novo NOME'),
'edit_item' => __('Editar NOME'),
'new_item' => __('Novo NOME'),
'view_item' => __('Ver NOME'),
'search_items' => __('Procurar NOME'),
'not_found' => __('Nada encontrado'),
'not_found_in_trash' => __('Nada encontrado na lixeira'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail')
);
register_post_type('nome_do_post_type', $args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment