From 626642f6cf3430e23652b352bf91da8f5e563009 Mon Sep 17 00:00:00 2001 From: Nichita Date: Thu, 8 Jun 2023 15:11:30 +0300 Subject: [PATCH 1/5] [WP]: bagrinsergiu/blox-editor#23105 - changed order of postLoopSources configuration --- editor/editor/editor.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/editor/editor.php b/editor/editor/editor.php index 4750339b22..c267b65cf7 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -490,6 +490,8 @@ private function getPostLoopSources( $config, $isTemplate, $wp_post_id, $context $excludePostTypes = [ 'attachment' ]; $types = get_post_types( [ 'public' => true ] ); + array_splice( $types, 0, 0, array_splice( $types, 1, 1 ) ); + $result = []; $templateTypeArchive = false; From d15c6caaa9a8a94b88ae5d05fe3d209049eb6aa3 Mon Sep 17 00:00:00 2001 From: Nichita Date: Thu, 8 Jun 2023 15:43:27 +0300 Subject: [PATCH 2/5] [WP]: bagrinsergiu/blox-editor#23105 - changed order of postLoopSources configuration (update) --- editor/editor/editor.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/editor/editor/editor.php b/editor/editor/editor.php index c267b65cf7..b773c9d781 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -490,7 +490,17 @@ private function getPostLoopSources( $config, $isTemplate, $wp_post_id, $context $excludePostTypes = [ 'attachment' ]; $types = get_post_types( [ 'public' => true ] ); - array_splice( $types, 0, 0, array_splice( $types, 1, 1 ) ); + + $typesOrder = [ 'page', 'post', 'editor-story' ]; + $sortedPostTypes = []; + foreach ( $typesOrder as $sort ) { + if ( isset($types[$sort]) ) { + $sortedPostTypes[$sort] = $types[$sort]; + unset($types[$sort]); + } + } + + $types = array_merge($sortedPostTypes, $types); $result = []; From fbf1afe601418dd273aa0cce08dd7b34dcca8019 Mon Sep 17 00:00:00 2001 From: Nichita Date: Thu, 8 Jun 2023 16:06:56 +0300 Subject: [PATCH 3/5] [WP]: bagrinsergiu/blox-editor#23105 - changed order of postLoopSources configuration (update 2) --- editor/editor/editor.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/editor/editor/editor.php b/editor/editor/editor.php index b773c9d781..fb4e8f50fb 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -489,20 +489,8 @@ private function addContentDefaults( $config, $context ) { private function getPostLoopSources( $config, $isTemplate, $wp_post_id, $context ) { $excludePostTypes = [ 'attachment' ]; - $types = get_post_types( [ 'public' => true ] ); - - $typesOrder = [ 'page', 'post', 'editor-story' ]; - $sortedPostTypes = []; - foreach ( $typesOrder as $sort ) { - if ( isset($types[$sort]) ) { - $sortedPostTypes[$sort] = $types[$sort]; - unset($types[$sort]); - } - } - - $types = array_merge($sortedPostTypes, $types); - - $result = []; + $types = array_merge(array_flip(['page', 'post', 'editor-story']), get_post_types(['public' => true])); + $result = []; $templateTypeArchive = false; if ( $isTemplate ) { From eabd86973d5ebca62557fcb62c8c20a657a8f9de Mon Sep 17 00:00:00 2001 From: Nichita Date: Fri, 9 Jun 2023 09:49:00 +0300 Subject: [PATCH 4/5] [WP]: bagrinsergiu/blox-editor#23105 - changed order of postLoopSources configuration (update 3) --- editor/editor/editor.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/editor/editor/editor.php b/editor/editor/editor.php index fb4e8f50fb..3d848a6488 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -489,7 +489,14 @@ private function addContentDefaults( $config, $context ) { private function getPostLoopSources( $config, $isTemplate, $wp_post_id, $context ) { $excludePostTypes = [ 'attachment' ]; - $types = array_merge(array_flip(['page', 'post', 'editor-story']), get_post_types(['public' => true])); + $types = get_post_types(['public' => true]); + + $typesSort = ['page', 'post', 'editor-story']; + + $types = array_merge($typesSort, array_filter($types, function ($type) use ($typesSort) { + return !in_array($type, $typesSort); + })); + $result = []; $templateTypeArchive = false; From bcedb5957548d0b1ebbf9796106139f8b5099ae6 Mon Sep 17 00:00:00 2001 From: Nichita Date: Fri, 9 Jun 2023 10:14:38 +0300 Subject: [PATCH 5/5] [WP]: bagrinsergiu/blox-editor#23105 - changed order of postLoopSources configuration (update 4) --- editor/editor/editor.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/editor/editor/editor.php b/editor/editor/editor.php index 3d848a6488..88c9de34a4 100755 --- a/editor/editor/editor.php +++ b/editor/editor/editor.php @@ -487,14 +487,13 @@ private function addContentDefaults( $config, $context ) { } private function getPostLoopSources( $config, $isTemplate, $wp_post_id, $context ) { - $excludePostTypes = [ 'attachment' ]; - $types = get_post_types(['public' => true]); $typesSort = ['page', 'post', 'editor-story']; + $excludePostTypes = ['page', 'post', 'editor-story', 'attachment']; - $types = array_merge($typesSort, array_filter($types, function ($type) use ($typesSort) { - return !in_array($type, $typesSort); + $types = array_merge($typesSort, array_filter($types, function ($type) use ($excludePostTypes) { + return !in_array($type, $excludePostTypes); })); $result = []; @@ -515,9 +514,6 @@ private function getPostLoopSources( $config, $isTemplate, $wp_post_id, $context } foreach ( $types as $type ) { - if ( in_array( $type, $excludePostTypes ) ) { - continue; - } $typeObj = get_post_type_object( $type ); $typeDto = [ 'name' => $typeObj->name,