diff --git a/README.txt b/README.txt index 7ec92b0..fca74c9 100644 --- a/README.txt +++ b/README.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/yycpro Tags: commerce7 Requires at least: 6.0 Tested up to: 6.7.1 -Stable tag: 1.4.7 +Stable tag: 1.4.8 License: GPLv3 or later License URI: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -72,6 +72,9 @@ Removing this plugin will render your widgets inactive, but will not remove them == Changelog == += 1.4.8 - January 2, 2025 = +* Fix: Disable C7 JS in Oxygen's frontend builder to prevent conflicts. + = 1.4.7 - December 13, 2024 = * Fix: Proper widgets loading when using compatibility mode. diff --git a/commerce7-for-wordpress.php b/commerce7-for-wordpress.php index 847bf0b..fee8d21 100644 --- a/commerce7-for-wordpress.php +++ b/commerce7-for-wordpress.php @@ -11,13 +11,13 @@ * @wordpress-plugin * Plugin Name: Commerce7 for WordPress * Description: Integrate Commerce7 functionality into your WordPress site easily - * Version: 1.4.7 + * Version: 1.4.8 * Author: 5forests * Author URI: https://5forests.com * Plugin URI: https://c7wp.com * Requires at least: 6.0 * Tested up to: 6.7.1 - * Stable tag: 1.4.7 + * Stable tag: 1.4.8 * Requires PHP: 7.4 * License: GPL3 * License URI: https://www.gnu.org/licenses/gpl-3.0.en.html @@ -27,10 +27,10 @@ * Created Date: Friday September 27th 2019 * Author: Michael Bourne * ----- - * Last Modified: Sunday, December 8th 2024, 1:33:04 pm + * Last Modified: Thursday, January 2nd 2025, 2:54:10 pm * Modified By: Michael Bourne * ----- - * Copyright (c) 2019-2024 URSA6 + * Copyright (c) 2019-2025 URSA6 * * Commerce7 for WordPress is a plugin for WordPress that enables you to add Commerce7 ecommerce integration into your site. * Plugin developed with permission of the Commerce7 company. Commerce7 logo and name used with permission. @@ -47,7 +47,7 @@ defined( 'C7WP_ROOT' ) || define( 'C7WP_ROOT', dirname( __FILE__ ) ); defined( 'C7WP_URI' ) || define( 'C7WP_URI', plugin_dir_url( __FILE__ ) ); -defined( 'C7WP_VERSION' ) || define( 'C7WP_VERSION', '1.4.7' ); +defined( 'C7WP_VERSION' ) || define( 'C7WP_VERSION', '1.4.8' ); /** diff --git a/includes/class-c7wp.php b/includes/class-c7wp.php index 18d7e7d..a94308a 100644 --- a/includes/class-c7wp.php +++ b/includes/class-c7wp.php @@ -75,6 +75,7 @@ private function __construct() { add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'elementor_editor_enqueue_scripts' ) ); add_action( 'after_setup_theme', array( $this, 'load_c7_css' ), 9 ); + add_filter( 'body_class', array( $this, 'add_body_class' ) ); // for front end add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 10 ); @@ -676,7 +677,17 @@ public function enqueue_scripts() { wp_register_script( 'c7js', 'https://cdn.commerce7.com/v2/commerce7.js', array(), null, true ); // phpcs:ignore break; } - wp_enqueue_script( 'c7js' ); + /** + * Enqueues the 'c7js' script if the following conditions are met: + * - The current request is not an admin request. + * - The 'ct_builder' query parameter is not present in the URL. + * + * This ensures that the C7 script is only enqueued on the front-end and not when + * using certain page builders like Oxygen. + */ + if ( ! is_admin() && empty( $_GET['ct_builder'] ) ) { + wp_enqueue_script( 'c7js' ); + } /** * Filter: `c7wp_enqueue_c7_css` @@ -1040,4 +1051,13 @@ public function add_display_post_states( $post_states, $post ) { return $post_states; } + + + /** + * Add body class for styles specificity and scope + */ + public function add_body_class( $classes ) { + $classes[] = 'c7wp'; + return $classes; + } } diff --git a/includes/gutenberg/load.php b/includes/gutenberg/load.php index 5268b5d..5a9adcc 100644 --- a/includes/gutenberg/load.php +++ b/includes/gutenberg/load.php @@ -5,7 +5,7 @@ * Created Date: Wednesday September 2nd 2020 * Author: Michael Bourne * ----- - * Last Modified: Sunday, December 8th 2024, 1:29:52 pm + * Last Modified: Tuesday, December 17th 2024, 3:46:08 pm * Modified By: Michael Bourne * ----- * Copyright (c) 2020 URSA6 @@ -60,7 +60,7 @@ wp_register_script( $block_slug, plugins_url( $dir . '/' . $element . '/' . $block_slug . '.js', __FILE__ ), - [ 'wp-blocks', 'wp-element', 'wp-editor', 'wp-block-editor' ], + [ 'wp-blocks', 'wp-element' ], C7WP_VERSION, 1 );