| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Easy Elements |
| 4 |
* Plugin URI: https://wpeasyelements.com |
| 5 |
* Description: Provides a set of custom Elementor widgets, shortcodes, and enhancements. |
| 6 |
* Version: 1.0.0 |
| 7 |
* Author: Themewant |
| 8 |
* Author URI: https://themewant.com/ |
| 9 |
* Text Domain: easy-elements |
| 10 |
* Domain Path: /languages |
| 11 |
* License: GPLv2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
*/ |
| 14 |
|
| 15 |
if ( ! defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
// Define constants |
| 21 |
define( 'EASYELEMENTS_FILE', __FILE__ ); |
| 22 |
define( 'EASYELEMENTS_DIR_PATH', plugin_dir_path( __FILE__ ) ); |
| 23 |
define( 'EASYELEMENTS_DIR_URL', plugin_dir_url( __FILE__ ) ); |
| 24 |
define( 'EASYELEMENTS_ASSETS_URL', EASYELEMENTS_DIR_URL . 'assets/' ); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
$required_files = [ |
| 29 |
'base.php', |
| 30 |
]; |
| 31 |
|
| 32 |
foreach ( $required_files as $file ) { |
| 33 |
$filepath = EASYELEMENTS_DIR_PATH . $file; |
| 34 |
if ( file_exists( $filepath ) ) { |
| 35 |
require_once $filepath; |
| 36 |
} else { |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
// Elementor missing notice |
| 42 |
function easy_elements_elementor_missing_notice() { |
| 43 |
echo '<div class="notice notice-error"><p>'; |
| 44 |
echo esc_html__( 'Easy Elements requires Elementor to be installed and activated.', 'easy-elements' ); |
| 45 |
echo '</p></div>'; |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
register_activation_hook( __FILE__, 'easy_elements_activate' ); |
| 50 |
function easy_elements_activate() { |
| 51 |
// Register post types first |
| 52 |
if (function_exists('easy_elements_register_archive_template_post_type')) { |
| 53 |
easy_elements_register_archive_template_post_type(); |
| 54 |
} |
| 55 |
flush_rewrite_rules(); |
| 56 |
} |
| 57 |
|
| 58 |
add_filter( 'body_class', function( $classes ) { |
| 59 |
if ( is_plugin_active( 'easy-elements/easy-elements.php' ) ) { |
| 60 |
$classes[] = 'eel-easy-elements'; |
| 61 |
} |
| 62 |
return $classes; |
| 63 |
}); |