Created
November 26, 2019 18:03
-
-
Save juizmill/626a3c06e6c6e5abafcc80f837f4b05e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('init', function () { | |
$labels = [ | |
'name' => _x('Blog', 'post type general name'), | |
'singular_name' => _x('Blog', 'post type singular name'), | |
'add_new' => _x('Adicionar Novo', 'Novo item'), | |
'add_new_item' => __('Novo Item'), | |
'edit_item' => __('Editar Item'), | |
'new_item' => __('Novo Item'), | |
'view_item' => __('Ver Item'), | |
'search_items' => __('Procurar Itens'), | |
'not_found' => __('Nenhum registro encontrado'), | |
'not_found_in_trash' => __('Nenhum registro encontrado na lixeira'), | |
'parent_item_colon' => '', | |
'menu_name' => 'Blog' | |
]; | |
$args = [ | |
'labels' => $labels, | |
'public' => true, | |
'public_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'show_in_nav_menus' => true, | |
'show_in_admin_bar' => true, | |
'query_var' => true, | |
'rewrite' => [ | |
'slug' => 'blog', | |
'with_front' => false | |
], | |
'capability_type' => 'post', | |
'has_archive' => true, | |
'hierarchical' => true, | |
'menu_position' => 3, | |
'register_meta_box_cb' => 'blog_meta_box', | |
'supports' => [ | |
'title', | |
'editor', | |
'thumbnail', | |
'comments', | |
'excerpt', | |
'revisions', | |
'trackbacks' | |
], | |
'taxonomies' => [ | |
'blog_category', | |
'blog_tags' | |
] | |
]; | |
register_post_type('blog', $args); | |
flush_rewrite_rules(); | |
}); | |
add_action('init', function () { | |
$labels = [ | |
'name' => _x('Category', 'taxonomy general name'), | |
'singular_name' => _x('Category', 'taxonomy singular name'), | |
'search_items' => __('Search Category'), | |
'all_items' => __('All Category'), | |
'parent_item' => __('Parent Category'), | |
'parent_item_colon' => __('Parent Category:'), | |
'edit_item' => __('Edit Category'), | |
'update_item' => __('Update Category'), | |
'add_new_item' => __('Add New Category'), | |
'new_item_name' => __('New Category Name'), | |
'menu_name' => __('Category'), | |
]; | |
register_taxonomy('blog_category', ['blog'], [ | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => [ | |
'slug' => 'blog/categoria', | |
'with_front' => false, | |
], | |
]); | |
flush_rewrite_rules(); | |
}); | |
add_action('init', function () { | |
$labels = [ | |
'name' => _x('Tag', 'taxonomy general name'), | |
'singular_name' => _x('Tag', 'taxonomy singular name'), | |
'search_items' => __('Search Tag'), | |
'all_items' => __('All Tag'), | |
'parent_item' => __('Parent Tag'), | |
'parent_item_colon' => __('Parent Tag:'), | |
'edit_item' => __('Edit Tag'), | |
'update_item' => __('Update Tag'), | |
'add_new_item' => __('Add New Tag'), | |
'new_item_name' => __('New Tag Name'), | |
'menu_name' => __('Tag'), | |
]; | |
register_taxonomy('blog_tag', ['blog'], [ | |
'hierarchical' => true, | |
'labels' => $labels, | |
'show_ui' => true, | |
'show_admin_column' => true, | |
'query_var' => true, | |
'rewrite' => [ | |
'slug' => 'blog/tag', | |
'with_front' => false | |
], | |
]); | |
flush_rewrite_rules(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment