_x( 'Artists', 'Post type general name', 'wp-fedistream' ), 'singular_name' => _x( 'Artist', 'Post type singular name', 'wp-fedistream' ), 'menu_name' => _x( 'Artists', 'Admin Menu text', 'wp-fedistream' ), 'name_admin_bar' => _x( 'Artist', 'Add New on Toolbar', 'wp-fedistream' ), 'add_new' => __( 'Add New', 'wp-fedistream' ), 'add_new_item' => __( 'Add New Artist', 'wp-fedistream' ), 'new_item' => __( 'New Artist', 'wp-fedistream' ), 'edit_item' => __( 'Edit Artist', 'wp-fedistream' ), 'view_item' => __( 'View Artist', 'wp-fedistream' ), 'all_items' => __( 'All Artists', 'wp-fedistream' ), 'search_items' => __( 'Search Artists', 'wp-fedistream' ), 'parent_item_colon' => __( 'Parent Artists:', 'wp-fedistream' ), 'not_found' => __( 'No artists found.', 'wp-fedistream' ), 'not_found_in_trash' => __( 'No artists found in Trash.', 'wp-fedistream' ), 'featured_image' => _x( 'Artist Photo', 'Overrides the "Featured Image" phrase', 'wp-fedistream' ), 'set_featured_image' => _x( 'Set artist photo', 'Overrides the "Set featured image" phrase', 'wp-fedistream' ), 'remove_featured_image' => _x( 'Remove artist photo', 'Overrides the "Remove featured image" phrase', 'wp-fedistream' ), 'use_featured_image' => _x( 'Use as artist photo', 'Overrides the "Use as featured image" phrase', 'wp-fedistream' ), 'archives' => _x( 'Artist archives', 'The post type archive label', 'wp-fedistream' ), 'insert_into_item' => _x( 'Insert into artist', 'Overrides the "Insert into post" phrase', 'wp-fedistream' ), 'uploaded_to_this_item' => _x( 'Uploaded to this artist', 'Overrides the "Uploaded to this post" phrase', 'wp-fedistream' ), 'filter_items_list' => _x( 'Filter artists list', 'Screen reader text', 'wp-fedistream' ), 'items_list_navigation' => _x( 'Artists list navigation', 'Screen reader text', 'wp-fedistream' ), 'items_list' => _x( 'Artists list', 'Screen reader text', 'wp-fedistream' ), ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => false, // Will be added to custom menu. 'query_var' => true, 'rewrite' => array( 'slug' => 'artists' ), 'capability_type' => array( 'fedistream_artist', 'fedistream_artists' ), 'map_meta_cap' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_position' => null, 'menu_icon' => 'dashicons-groups', 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'revisions' ), 'show_in_rest' => true, 'rest_base' => 'artists', ); register_post_type( $this->post_type, $args ); } /** * Add meta boxes. * * @return void */ public function add_meta_boxes(): void { add_meta_box( 'fedistream_artist_info', __( 'Artist Information', 'wp-fedistream' ), array( $this, 'render_info_meta_box' ), $this->post_type, 'normal', 'high' ); add_meta_box( 'fedistream_artist_social', __( 'Social Links', 'wp-fedistream' ), array( $this, 'render_social_meta_box' ), $this->post_type, 'normal', 'default' ); add_meta_box( 'fedistream_artist_members', __( 'Band Members', 'wp-fedistream' ), array( $this, 'render_members_meta_box' ), $this->post_type, 'side', 'default' ); } /** * Render artist info meta box. * * @param \WP_Post $post Post object. * @return void */ public function render_info_meta_box( \WP_Post $post ): void { wp_nonce_field( 'fedistream_artist_save', 'fedistream_artist_nonce' ); $artist_type = get_post_meta( $post->ID, self::META_PREFIX . 'type', true ); $formed_date = get_post_meta( $post->ID, self::META_PREFIX . 'formed_date', true ); $location = get_post_meta( $post->ID, self::META_PREFIX . 'location', true ); $website = get_post_meta( $post->ID, self::META_PREFIX . 'website', true ); ?>