From df17c2f33c742872986b7f0d6cac037cba4e7c71 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 5 Sep 2024 12:18:11 +0530 Subject: [PATCH] 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 ) ); }