From ae7dee9744c52ee717cc5952369f426d93f0f7c3 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 29 Aug 2024 15:36:13 +0530 Subject: [PATCH 01/11] fix: cover layout issue with CPT --- inc/customizer/defaults/single_post.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/customizer/defaults/single_post.php b/inc/customizer/defaults/single_post.php index 202bd1d04b..89b0d0a8e6 100644 --- a/inc/customizer/defaults/single_post.php +++ b/inc/customizer/defaults/single_post.php @@ -128,7 +128,10 @@ public function get_cpt_context( $allowed = [ 'post', 'page' ] ) { */ $allowed_context = apply_filters( 'neve_allowed_custom_post_types', $allowed, 10, 1 ); $context = get_post_type(); - $context = apply_filters( 'neve_context_filter', $context, 10, 1 ); + if ( ! has_filter( 'neve_context_filter' ) && ! in_array( get_post_type(), $allowed_context, true ) ) { + $context = 'post'; + } + $context = apply_filters( 'neve_context_filter', $context, 10, 1 ); return [ $context, $allowed_context ]; } From 98233f15cde806ceeecd2e7be2e4f843f516e1a6 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 3 Sep 2024 15:31:59 +0530 Subject: [PATCH 02/11] fix: apply default layout when pro addon is inactive --- inc/customizer/defaults/single_post.php | 5 +---- inc/customizer/options/layout_single_page.php | 2 +- inc/customizer/options/layout_single_post.php | 2 +- inc/views/post_layout.php | 4 ++++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/inc/customizer/defaults/single_post.php b/inc/customizer/defaults/single_post.php index 89b0d0a8e6..202bd1d04b 100644 --- a/inc/customizer/defaults/single_post.php +++ b/inc/customizer/defaults/single_post.php @@ -128,10 +128,7 @@ public function get_cpt_context( $allowed = [ 'post', 'page' ] ) { */ $allowed_context = apply_filters( 'neve_allowed_custom_post_types', $allowed, 10, 1 ); $context = get_post_type(); - if ( ! has_filter( 'neve_context_filter' ) && ! in_array( get_post_type(), $allowed_context, true ) ) { - $context = 'post'; - } - $context = apply_filters( 'neve_context_filter', $context, 10, 1 ); + $context = apply_filters( 'neve_context_filter', $context, 10, 1 ); return [ $context, $allowed_context ]; } diff --git a/inc/customizer/options/layout_single_page.php b/inc/customizer/options/layout_single_page.php index 3dd94c1d8d..57f0868e6f 100644 --- a/inc/customizer/options/layout_single_page.php +++ b/inc/customizer/options/layout_single_page.php @@ -61,6 +61,6 @@ public function add_controls() { * @return bool */ public static function is_cover_layout() { - return get_theme_mod( 'neve_page_header_layout' ) === 'cover'; + return class_exists( '\Neve_Pro\Admin\Custom_Layouts_Cpt' ) && get_theme_mod( 'neve_page_header_layout' ) === 'cover'; } } diff --git a/inc/customizer/options/layout_single_post.php b/inc/customizer/options/layout_single_post.php index 5f78414944..1cb3f6791e 100644 --- a/inc/customizer/options/layout_single_post.php +++ b/inc/customizer/options/layout_single_post.php @@ -658,7 +658,7 @@ public function sanitize_post_elements_ordering( $value ) { * @return bool */ public static function is_cover_layout() { - return get_theme_mod( 'neve_post_header_layout' ) === 'cover'; + return class_exists( '\Neve_Pro\Admin\Custom_Layouts_Cpt' ) && get_theme_mod( 'neve_post_header_layout' ) === 'cover'; } /** diff --git a/inc/views/post_layout.php b/inc/views/post_layout.php index 513b31a494..01567ebd96 100644 --- a/inc/views/post_layout.php +++ b/inc/views/post_layout.php @@ -232,6 +232,10 @@ private function get_content_order() { } } + if ( ! class_exists( '\Neve_Pro\Admin\Custom_Layouts_Cpt' ) ) { + $content_order = array_unique( array_merge( array( 'title-meta' ), $content_order ) ); + } + return apply_filters( 'neve_layout_single_post_elements_order', $content_order ); } } From c8ed6fbddb7c16436af2a9e46320c9f282215c78 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 3 Sep 2024 15:55:18 +0530 Subject: [PATCH 03/11] fix: e2e testcase error --- inc/views/post_layout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/views/post_layout.php b/inc/views/post_layout.php index 01567ebd96..caed7702d0 100644 --- a/inc/views/post_layout.php +++ b/inc/views/post_layout.php @@ -232,7 +232,7 @@ private function get_content_order() { } } - if ( ! class_exists( '\Neve_Pro\Admin\Custom_Layouts_Cpt' ) ) { + if ( ! Layout_Single_Post::is_cover_layout() ) { $content_order = array_unique( array_merge( array( 'title-meta' ), $content_order ) ); } From da6ef13aac1bc76b6e4697fb63b96e0f6cab59bd Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 3 Sep 2024 16:20:01 +0530 Subject: [PATCH 04/11] fix: e2e remove .entry-header class from hidden list --- e2e-tests/specs/customizer/layout/single-post-settings.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index ad616214de..e4c4fbdf84 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -89,7 +89,6 @@ test.describe('Single Post Check', function () { baseURL, }); const HIDDEN = [ - '.entry-header', '.nv-thumb-wrap', '.entry-content', '.nv-tags-list', @@ -120,7 +119,6 @@ test.describe('Single Post Check', function () { 'nv-tags-list', 'nv-content-wrap', 'comments-area', - 'entry-header', 'nv-thumb-wrap', ]; await page.goto( From 6936cb55e7fb8f27f946445c4cc4791c26c6b23a Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 3 Sep 2024 16:54:25 +0530 Subject: [PATCH 05/11] fix: e2e all elements enabled and reordered --- e2e-tests/specs/customizer/layout/single-post-settings.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index e4c4fbdf84..c54f39ab82 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -119,6 +119,7 @@ test.describe('Single Post Check', function () { 'nv-tags-list', 'nv-content-wrap', 'comments-area', + 'entry-header', 'nv-thumb-wrap', ]; await page.goto( From 0ca744ea4f7439c3c0b5423ccc11999a52dc95d1 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 3 Sep 2024 17:13:37 +0530 Subject: [PATCH 06/11] fix: e2e issue with layout elements reordered --- e2e-tests/specs/customizer/layout/single-post-settings.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index c54f39ab82..ea0d9cd6bd 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -115,11 +115,11 @@ test.describe('Single Post Check', function () { baseURL, }); const ORDER = [ + 'entry-header', 'nv-post-navigation', 'nv-tags-list', 'nv-content-wrap', 'comments-area', - 'entry-header', 'nv-thumb-wrap', ]; await page.goto( From fe97f575d16668f77a9204ec08861c89a864e003 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 3 Sep 2024 18:13:32 +0530 Subject: [PATCH 07/11] fix: e2e issue with backgound layout cover color --- e2e-tests/specs/customizer/layout/single-post-settings.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index ea0d9cd6bd..f40d33030e 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -142,7 +142,7 @@ test.describe('Single Post Check', function () { 'background-color', 'rgb(198, 53, 53)' ); - await expect(page.locator('.nv-title-meta-wrap')).toHaveCSS( + await expect(page.locator('.nv-post-cover .nv-title-meta-wrap').first()).toHaveCSS( 'color', 'rgb(255, 255, 255)' ); From df17c2f33c742872986b7f0d6cac037cba4e7c71 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 5 Sep 2024 12:18:11 +0530 Subject: [PATCH 08/11] fix: resolve cover layout and styling issues in the free version --- .../specs/customizer/layout/single-post-settings.spec.ts | 2 +- inc/customizer/defaults/single_post.php | 5 ++++- inc/views/cover_header.php | 4 ++++ inc/views/post_layout.php | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index f40d33030e..ea0d9cd6bd 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -142,7 +142,7 @@ test.describe('Single Post Check', function () { 'background-color', 'rgb(198, 53, 53)' ); - await expect(page.locator('.nv-post-cover .nv-title-meta-wrap').first()).toHaveCSS( + await expect(page.locator('.nv-title-meta-wrap')).toHaveCSS( 'color', 'rgb(255, 255, 255)' ); diff --git a/inc/customizer/defaults/single_post.php b/inc/customizer/defaults/single_post.php index 202bd1d04b..89b0d0a8e6 100644 --- a/inc/customizer/defaults/single_post.php +++ b/inc/customizer/defaults/single_post.php @@ -128,7 +128,10 @@ public function get_cpt_context( $allowed = [ 'post', 'page' ] ) { */ $allowed_context = apply_filters( 'neve_allowed_custom_post_types', $allowed, 10, 1 ); $context = get_post_type(); - $context = apply_filters( 'neve_context_filter', $context, 10, 1 ); + if ( ! has_filter( 'neve_context_filter' ) && ! in_array( get_post_type(), $allowed_context, true ) ) { + $context = 'post'; + } + $context = apply_filters( 'neve_context_filter', $context, 10, 1 ); return [ $context, $allowed_context ]; } diff --git a/inc/views/cover_header.php b/inc/views/cover_header.php index 75be4dcdab..451fb907b3 100644 --- a/inc/views/cover_header.php +++ b/inc/views/cover_header.php @@ -33,6 +33,10 @@ public function render_cover_header() { return; } + if ( ! class_exists( '\Neve_Pro\Admin\Custom_Layouts_Cpt' ) && get_post_type() !== $context ) { + return; + } + $header_layout = get_theme_mod( 'neve_' . $context . '_header_layout', 'normal' ); if ( $header_layout !== 'cover' ) { return; diff --git a/inc/views/post_layout.php b/inc/views/post_layout.php index caed7702d0..095e9a264b 100644 --- a/inc/views/post_layout.php +++ b/inc/views/post_layout.php @@ -232,7 +232,8 @@ private function get_content_order() { } } - if ( ! Layout_Single_Post::is_cover_layout() ) { + list( $context ) = $this->get_cpt_context(); + if ( ! Layout_Single_Post::is_cover_layout() && get_post_type() !== $context ) { $content_order = array_unique( array_merge( array( 'title-meta' ), $content_order ) ); } From b79e03aa3c6f654e3d6f8bd3dfefa0d5bb1812de Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 5 Sep 2024 12:52:47 +0530 Subject: [PATCH 09/11] fix: e2e remove .entry-header class from order list --- e2e-tests/specs/customizer/layout/single-post-settings.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index ea0d9cd6bd..e4c4fbdf84 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -115,7 +115,6 @@ test.describe('Single Post Check', function () { baseURL, }); const ORDER = [ - 'entry-header', 'nv-post-navigation', 'nv-tags-list', 'nv-content-wrap', From 5fa0fb1ca738a44f84165190c2a994f7bc871f75 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 5 Sep 2024 14:05:42 +0530 Subject: [PATCH 10/11] fix: revert e2e elements reordered changes --- e2e-tests/specs/customizer/layout/single-post-settings.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index e4c4fbdf84..518eddc551 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -119,6 +119,7 @@ test.describe('Single Post Check', function () { 'nv-tags-list', 'nv-content-wrap', 'comments-area', + 'entry-header' 'nv-thumb-wrap', ]; await page.goto( From 23547d78d7a789619749d01e519bfa801c647dff Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 5 Sep 2024 14:15:45 +0530 Subject: [PATCH 11/11] fix: syntax error --- e2e-tests/specs/customizer/layout/single-post-settings.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts index 518eddc551..c54f39ab82 100644 --- a/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/single-post-settings.spec.ts @@ -119,7 +119,7 @@ test.describe('Single Post Check', function () { 'nv-tags-list', 'nv-content-wrap', 'comments-area', - 'entry-header' + 'entry-header', 'nv-thumb-wrap', ]; await page.goto(