From a610ca91829d419879e659b2109c370e9d7a4390 Mon Sep 17 00:00:00 2001 From: spsiddarthan Date: Fri, 2 Feb 2024 17:44:18 +0530 Subject: [PATCH 1/5] Social : Register CPT for Social Notes. --- .../social/src/class-jetpack-social-note.php | 32 +++++++++++++++++++ .../social/src/class-jetpack-social.php | 5 +++ 2 files changed, 37 insertions(+) create mode 100644 projects/plugins/social/src/class-jetpack-social-note.php diff --git a/projects/plugins/social/src/class-jetpack-social-note.php b/projects/plugins/social/src/class-jetpack-social-note.php new file mode 100644 index 0000000000000..251324cc39397 --- /dev/null +++ b/projects/plugins/social/src/class-jetpack-social-note.php @@ -0,0 +1,32 @@ + true, + 'label' => 'Social Note', + 'show_in_rest' => true, + 'supports' => array( 'editor', 'thumbnail', 'publicize' ), + 'menu_icon' => 'dashicons-welcome-write-blog', + + ); + register_post_type( 'jetpack_social_note', $args ); + } +} diff --git a/projects/plugins/social/src/class-jetpack-social.php b/projects/plugins/social/src/class-jetpack-social.php index 8c12545f1b345..4d7ee1e67541b 100644 --- a/projects/plugins/social/src/class-jetpack-social.php +++ b/projects/plugins/social/src/class-jetpack-social.php @@ -104,6 +104,11 @@ function () { My_Jetpack_Initializer::init(); } ); + add_action( + 'init', + array( new Automattic\Jetpack\Social\Jetpack_Social_Note(), 'register' ), + 1 + ); $this->manager = $connection_manager ? $connection_manager : new Connection_Manager(); From 8639125e529d2297cf598aef4a4e8a9bf8c36dbf Mon Sep 17 00:00:00 2001 From: spsiddarthan Date: Fri, 2 Feb 2024 17:44:59 +0530 Subject: [PATCH 2/5] changelog --- .../social/changelog/add-register-social-note-custom-type | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/social/changelog/add-register-social-note-custom-type diff --git a/projects/plugins/social/changelog/add-register-social-note-custom-type b/projects/plugins/social/changelog/add-register-social-note-custom-type new file mode 100644 index 0000000000000..841b54fb3c4c7 --- /dev/null +++ b/projects/plugins/social/changelog/add-register-social-note-custom-type @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Register CPT for Social Notes. From 6c3f2ff3789ec959ed9cb494db0ff5d4adbdc1fb Mon Sep 17 00:00:00 2001 From: spsiddarthan Date: Mon, 5 Feb 2024 13:24:15 +0530 Subject: [PATCH 3/5] Social: Added arguments for labels. --- .../social/src/class-jetpack-social-note.php | 32 ----------- .../social/src/class-jetpack-social.php | 6 +-- projects/plugins/social/src/class-note.php | 53 +++++++++++++++++++ 3 files changed, 54 insertions(+), 37 deletions(-) delete mode 100644 projects/plugins/social/src/class-jetpack-social-note.php create mode 100644 projects/plugins/social/src/class-note.php diff --git a/projects/plugins/social/src/class-jetpack-social-note.php b/projects/plugins/social/src/class-jetpack-social-note.php deleted file mode 100644 index 251324cc39397..0000000000000 --- a/projects/plugins/social/src/class-jetpack-social-note.php +++ /dev/null @@ -1,32 +0,0 @@ - true, - 'label' => 'Social Note', - 'show_in_rest' => true, - 'supports' => array( 'editor', 'thumbnail', 'publicize' ), - 'menu_icon' => 'dashicons-welcome-write-blog', - - ); - register_post_type( 'jetpack_social_note', $args ); - } -} diff --git a/projects/plugins/social/src/class-jetpack-social.php b/projects/plugins/social/src/class-jetpack-social.php index 4d7ee1e67541b..29f1a3ef721d4 100644 --- a/projects/plugins/social/src/class-jetpack-social.php +++ b/projects/plugins/social/src/class-jetpack-social.php @@ -104,11 +104,7 @@ function () { My_Jetpack_Initializer::init(); } ); - add_action( - 'init', - array( new Automattic\Jetpack\Social\Jetpack_Social_Note(), 'register' ), - 1 - ); + add_action( 'init', array( new Automattic\Jetpack\Social\Note(), 'register' ) ); $this->manager = $connection_manager ? $connection_manager : new Connection_Manager(); diff --git a/projects/plugins/social/src/class-note.php b/projects/plugins/social/src/class-note.php new file mode 100644 index 0000000000000..eb9141bcdfb1c --- /dev/null +++ b/projects/plugins/social/src/class-note.php @@ -0,0 +1,53 @@ + true, + 'labels' => array( + 'name' => _x( 'Social Notes', 'Post type general name', 'jetpack-social' ), + 'singular_name' => _x( 'Social Note', 'Post type singular name', 'jetpack-social' ), + 'menu_name' => _x( 'Social Notes', 'Admin Menu text', 'jetpack-social' ), + 'name_admin_bar' => _x( 'Social Note', 'Add New on Toolbar', 'jetpack-social' ), + 'add_new' => __( 'Add New', 'jetpack-social' ), + 'add_new_item' => __( 'Add New Social Note', 'jetpack-social' ), + 'new_item' => __( 'New Social Note', 'jetpack-social' ), + 'edit_item' => __( 'Edit Social Note', 'jetpack-social' ), + 'view_item' => __( 'View Social Note', 'jetpack-social' ), + 'all_items' => __( 'All Social Notes', 'jetpack-social' ), + 'search_items' => __( 'Search Social Notes', 'jetpack-social' ), + 'parent_item_colon' => __( 'Parent Social Notes:', 'jetpack-social' ), + 'not_found' => __( 'No Social Notes found.', 'jetpack-social' ), + 'not_found_in_trash' => __( 'No Social Notes found in Trash.', 'jetpack-social' ), + 'archives' => _x( 'Social Notes archives', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', 'jetpack-social' ), + 'insert_into_item' => _x( 'Insert into Social Note', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', 'jetpack-social' ), + 'uploaded_to_this_item' => _x( 'Uploaded to this Social Note', 'Overrides the “Uploaded to this post”/”Uploaded to this page” phrase (used when viewing media attached to a post). Added in 4.4', 'jetpack-social' ), + 'filter_items_list' => _x( 'Filter Social Nots list', 'Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4', 'jetpack-social' ), + 'items_list_navigation' => _x( 'Social Notes list navigation', 'Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4', 'jetpack-social' ), + 'items_list' => _x( 'Social Notes list', 'Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4', 'jetpack-social' ), + ), + 'show_in_rest' => true, + 'supports' => array( 'editor', 'thumbnail', 'publicize' ), + 'menu_icon' => 'dashicons-welcome-write-blog', + + ); + register_post_type( 'jetpack_social_note', $args ); + } +} From 1c6e1a34494594bf3ab4a765ee08f49b9f33449a Mon Sep 17 00:00:00 2001 From: spsiddarthan Date: Mon, 5 Feb 2024 16:31:14 +0530 Subject: [PATCH 4/5] Update labels for Social Note: --- projects/plugins/social/src/class-note.php | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/projects/plugins/social/src/class-note.php b/projects/plugins/social/src/class-note.php index eb9141bcdfb1c..e62ed25a7758c 100644 --- a/projects/plugins/social/src/class-note.php +++ b/projects/plugins/social/src/class-note.php @@ -22,26 +22,26 @@ public static function register() { $args = array( 'public' => true, 'labels' => array( - 'name' => _x( 'Social Notes', 'Post type general name', 'jetpack-social' ), - 'singular_name' => _x( 'Social Note', 'Post type singular name', 'jetpack-social' ), - 'menu_name' => _x( 'Social Notes', 'Admin Menu text', 'jetpack-social' ), - 'name_admin_bar' => _x( 'Social Note', 'Add New on Toolbar', 'jetpack-social' ), - 'add_new' => __( 'Add New', 'jetpack-social' ), - 'add_new_item' => __( 'Add New Social Note', 'jetpack-social' ), - 'new_item' => __( 'New Social Note', 'jetpack-social' ), - 'edit_item' => __( 'Edit Social Note', 'jetpack-social' ), - 'view_item' => __( 'View Social Note', 'jetpack-social' ), - 'all_items' => __( 'All Social Notes', 'jetpack-social' ), - 'search_items' => __( 'Search Social Notes', 'jetpack-social' ), - 'parent_item_colon' => __( 'Parent Social Notes:', 'jetpack-social' ), - 'not_found' => __( 'No Social Notes found.', 'jetpack-social' ), - 'not_found_in_trash' => __( 'No Social Notes found in Trash.', 'jetpack-social' ), - 'archives' => _x( 'Social Notes archives', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', 'jetpack-social' ), - 'insert_into_item' => _x( 'Insert into Social Note', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', 'jetpack-social' ), - 'uploaded_to_this_item' => _x( 'Uploaded to this Social Note', 'Overrides the “Uploaded to this post”/”Uploaded to this page” phrase (used when viewing media attached to a post). Added in 4.4', 'jetpack-social' ), - 'filter_items_list' => _x( 'Filter Social Nots list', 'Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4', 'jetpack-social' ), - 'items_list_navigation' => _x( 'Social Notes list navigation', 'Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4', 'jetpack-social' ), - 'items_list' => _x( 'Social Notes list', 'Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4', 'jetpack-social' ), + 'name' => esc_html__( 'Social Notes', 'jetpack-social' ), + 'singular_name' => esc_html__( 'Social Note', 'jetpack-social' ), + 'menu_name' => esc_html__( 'Social Notes', 'jetpack-social' ), + 'name_admin_bar' => esc_html__( 'Social Note', 'jetpack-social' ), + 'add_new' => esc_html__( 'Add New', 'jetpack-social' ), + 'add_new_item' => esc_html__( 'Add New Note', 'jetpack-social' ), + 'new_item' => esc_html__( 'New Note', 'jetpack-social' ), + 'edit_item' => esc_html__( 'Edit Note', 'jetpack-social' ), + 'view_item' => esc_html__( 'View Note', 'jetpack-social' ), + 'all_items' => esc_html__( 'All Notes', 'jetpack-social' ), + 'search_items' => esc_html__( 'Search Notes', 'jetpack-social' ), + 'parent_item_colon' => esc_html__( 'Parent Notes:', 'jetpack-social' ), + 'not_found' => esc_html__( 'No Notes found.', 'jetpack-social' ), + 'not_found_in_trash' => esc_html__( 'No Notes found in Trash.', 'jetpack-social' ), + 'archives' => esc_html__( 'Notes archives', 'jetpack-social' ), + 'insert_into_item' => esc_html__( 'Insert into Note', 'jetpack-social' ), + 'uploaded_to_this_item' => esc_html__( 'Uploaded to this Note', 'jetpack-social' ), + 'filter_items_list' => esc_html__( 'Filter Notes list', 'jetpack-social' ), + 'items_list_navigation' => esc_html__( 'Notes list navigation', 'jetpack-social' ), + 'items_list' => esc_html__( 'Notes list', 'jetpack-social' ), ), 'show_in_rest' => true, 'supports' => array( 'editor', 'thumbnail', 'publicize' ), From fd85a7ca5cfa300b0c2b4d39bfe2c81ccfb86999 Mon Sep 17 00:00:00 2001 From: spsiddarthan Date: Mon, 5 Feb 2024 17:18:23 +0530 Subject: [PATCH 5/5] Hypenate custom post type slug. --- projects/plugins/social/src/class-note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/plugins/social/src/class-note.php b/projects/plugins/social/src/class-note.php index e62ed25a7758c..dd04b02e668e6 100644 --- a/projects/plugins/social/src/class-note.php +++ b/projects/plugins/social/src/class-note.php @@ -48,6 +48,6 @@ public static function register() { 'menu_icon' => 'dashicons-welcome-write-blog', ); - register_post_type( 'jetpack_social_note', $args ); + register_post_type( 'jetpack-social-note', $args ); } }