Skip to content

Instantly share code, notes, and snippets.

@tacensi
Created October 27, 2014 14:07
Show Gist options
  • Save tacensi/a05ad2227aedadb1489c to your computer and use it in GitHub Desktop.
Save tacensi/a05ad2227aedadb1489c to your computer and use it in GitHub Desktop.
WP New Custom Post Type
function mg_dicas() {
$labels = array(
'name' => 'Dicas',
'singular_name' => 'Dica',
'menu_name' => 'Dicas',
'parent_item_colon' => 'Dica mãe:',
'all_items' => 'Todas dicas',
'view_item' => 'Ver dica',
'add_new_item' => 'Adicionar dica',
'new_item' => 'Nova dica',
'add_new' => 'Nova dica',
'edit_item' => 'Editar dica',
'update_item' => 'Atualizar dica',
'search_items' => 'Buscar no dica',
'not_found' => 'Dica não encontrado',
'not_found_in_trash' => 'Não encontrada na lixeira',
);
$args = array(
'label' => 'Dica',
'description' => 'Dicas',
'labels' => $labels,
'supports' => array(
'title',
'editor',
'excerpt',
'author',
'thumbnail',
// 'comments',
// 'trackbacks',
'revisions',
// 'custom-fields',
// 'page-attributes',
// 'post-formats',
),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-edit',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'rewrite' => array( 'slug' => 'dica', 'with_front' => true ),
);
register_post_type( 'dica', $args );
flush_rewrite_rules( false );
}
// Hook into the 'init' action
add_action( 'init', 'mg_dicas', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment