The functions add_menu_page
and add_submenu_page
are anyway, if you want to fill that question you will have to customize everything from <h2>Insira um artigo</h2>
.
But what you are looking for are Types of Personalized Posts . The following code creates a TPP. Remarks:
-
meu-tpp
domain is used for translation, check out Translating WordPress documentation. But if you want you can remove all functions __()
and _x()
by leaving the strings clean.
- Also check out the various parameters that can be used in
register_post_type
, especially in the 'supports' => array( 'title', 'editor', etcetera )
array.
- To further customize TPP, we'll use Custom Meta Boxes , which can be registered in the
register_meta_box_cb
option (disabled in the example below). See an example in the OS.
add_action( 'init', 'criar_artigos_sopt_9881' );
function criar_artigos_sopt_9881()
{
$labels = array(
'name' => _x( 'Artigos', 'post type general name', 'meu-tpp' ),
'singular_name' => _x( 'Artigo', 'post type singular name', 'meu-tpp' ),
'add_new' => _x( 'Add New', 'artigo', 'meu-tpp' ),
'add_new_item' => __( 'Add New Artigo', 'meu-tpp' ),
'edit_item' => __( 'Edit Artigo', 'meu-tpp' ),
'new_item' => __( 'New Artigo', 'meu-tpp' ),
'all_items' => __( 'All Artigos', 'meu-tpp' ),
'view_item' => __( 'View Artigo', 'meu-tpp' ),
'search_items' => __( 'Search Artigos', 'meu-tpp' ),
'not_found' => __( 'No artigos found', 'meu-tpp' ),
'not_found_in_trash' => __( 'No artigos found in Trash', 'meu-tpp' ),
'parent_item_colon' => '',
'menu_name' => __( 'Artigos', 'meu-tpp' )
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => _x( 'artigo', 'URL slug', 'meu-tpp' ) ),
'capability_type' => 'page',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'taxonomies' => array('category'),
'supports' => array( 'title', 'editor', 'comments', 'custom-fields', 'thumbnail' ),
//'register_meta_box_cb' => 'my_meta_boxes'
);
register_post_type( 'artigo', $args );
}