From 21ff8b6f391ad2194ee30100083a282722d23090 Mon Sep 17 00:00:00 2001 From: Hardeep Asrani Date: Wed, 20 Sep 2023 04:35:07 +0530 Subject: [PATCH] fix: avoid loading editor promos when used with Enfold theme --- src/Modules/Promotions.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Modules/Promotions.php b/src/Modules/Promotions.php index cdb5000b..6f6ca0d4 100644 --- a/src/Modules/Promotions.php +++ b/src/Modules/Promotions.php @@ -268,6 +268,22 @@ public function is_writeable() { return false; } + /** + * Third-party compatibility. + * + * @return boolean + */ + private function has_conflicts() { + global $pagenow; + + // Editor notices aren't compatible with Enfold theme. + if ( defined( 'AV_FRAMEWORK_VERSION' ) && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { + return true; + } + + return false; + } + /** * Get promotions. * @@ -359,7 +375,7 @@ private function get_promotions() { foreach ( $all as $slug => $data ) { foreach ( $data as $key => $conditions ) { - if ( ! $conditions['env'] ) { + if ( ! $conditions['env'] || $this->has_conflicts() ) { unset( $all[ $slug ][ $key ] ); continue;