Add New for Admin Menu
-
I am learning WordPress Plugin development. I need to create a
Add New
like this image .My code is like below.
public function register_custom_post_type() { $supports = ['title']; $labels = [ 'name' => __( 'News', 'wpwi' ), 'singular_name' => __( 'News', 'wpwi' ), 'name_admin_bar' => __( 'News', 'wpwi' ), 'add_new' => __( 'Add New', 'wpwi' ), 'add_new_item' => __( 'Add New News', 'wpwi' ), 'new_item' => __( 'New News', 'wpwi' ), 'edit_item' => __( 'Edit News', 'wpwi' ), 'all_items' => __( 'News', 'wpwi' ), 'search_items' => __( 'Search News', 'wpwi' ), 'not_found' => __( 'No News Found.', 'wpwi' ), ]; $args = [ 'public' => true, 'show_ui' => true, 'supports' => $supports, 'labels' => $labels, 'description' => 'News Information', 'has_archive' => true, 'exclude_from_search' => false, 'show_in_menu' => 'news_info', ]; register_post_type( 'news_info', $args ); } public function admin_menu() { add_menu_page( __( 'News Information', 'wpwi' ), 'News Info', 'manage_options', 'news_info', [$this, 'api_key_page'], 'dashicons-info-outline', 30 ); add_submenu_page( 'news_info', __( 'News Information', 'wpwi' ), 'API Key', 'manage_options', 'news_info_page', [$this, 'api_key_page'], 0 ); add_submenu_page( 'news_info', __( 'News Information', 'wpwi' ), 'Add News', 'manage_options', 'news_info', 'call_back_function', 1 ); }
But I can’t see
Add New
.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Add New for Admin Menu’ is closed to new replies.