is_compatible()) { add_action('elementor/init', [$this, 'init']); } // set the constants first $this->setConstants(); // Register the custom autoloading function. spl_autoload_register([$this, 'autoload']); // register the activation register_activation_hook(__FILE__, [$this, 'activate']); // registser the deactivation register_deactivation_hook(__FILE__, [$this, 'deactivate']); // Hook into WordPress after theme setup add_action('after_setup_theme', array($this, 'abcbiz_elementor_custom_thumbnail_size')); // Add extranal file for extra functionality $this->include_external_file(); } // Register a custom thumbnail size function abcbiz_elementor_custom_thumbnail_size() { // Register a custom thumbnail size add_image_size('abcbiz-elementor-post', 635, 542, true); add_image_size('abcbiz_blog_list_thumb', 600, 450, true); add_image_size('abcbiz_blog_grid_thumb', 900, 600, true); add_image_size('abcbiz_square_img', 800, 800, true); } // Add extranal file for extra functionality public function include_external_file() { require_once ABCBIZ_Path . '/includes/admin/abcbiz-metabox.php'; require_once ABCBIZ_Path . '/includes/widgets/abcbiz-widgets-functions.php'; } /** * setConstants. */ public function setConstants() { define('ABCBIZ_Version', $this->version); define('ABCBIZ_Name', esc_html__('ABCBiz Addons for Elementor', 'abcbiz-addons')); } /** * Compatibility Checks */ public function is_compatible() { // Check if Elementor installed and activated if (!did_action('elementor/loaded')) { add_action('admin_notices', [$this, 'admin_notice_missing_main_plugin']); return false; } // Check for required Elementor version if (!version_compare(ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=')) { add_action('admin_notices', [$this, 'admin_notice_minimum_elementor_version']); return false; } // Check for required PHP version if (version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '<')) { add_action('admin_notices', [$this, 'admin_notice_minimum_php_version']); return false; } return true; } /** * Warning when the site doesn't have Elementor installed or activated. */ public function admin_notice_missing_main_plugin() { if (isset($_GET['activate'])) { unset($_GET['activate']); } $message = sprintf( esc_html__('"%1$s" requires "%2$s" to be installed and activated.', 'abcbiz-addons'), '' . esc_html(ABCBIZ_Name) . '', '' . esc_html__('Elementor', 'abcbiz-addons') . '' ); printf('
%1$s
%s
%1$s