| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
|
| 4 |
add_filter('ultp_addons_config', 'ultp_elementor_config'); |
| 5 |
function ultp_elementor_config( $config ) { |
| 6 |
$configuration = array( |
| 7 |
'name' => __( 'Elementor Addons', 'ultimate-post' ), |
| 8 |
'desc' => __( 'Use Gutenberg blocks inside Elementor via Save Template addons.', 'ultimate-post' ), |
| 9 |
'img' => ULTP_URL.'/assets/img/addons/elementor-icon.svg', |
| 10 |
'is_pro' => false, |
| 11 |
'live' => 'https://www.wpxpo.com/postx/addons/elementor/', |
| 12 |
'docs' => 'https://docs.wpxpo.com/docs/postx/add-on/elementor-addon/', |
| 13 |
); |
| 14 |
$arr['ultp_elementor'] = $configuration; |
| 15 |
return $arr + $config; |
| 16 |
} |
| 17 |
|
| 18 |
add_action('plugins_loaded', 'ultp_elementor_init'); |
| 19 |
function ultp_elementor_init(){ |
| 20 |
$settings = ultimate_post()->get_setting('ultp_elementor'); |
| 21 |
if ($settings == 'true') { |
| 22 |
if(did_action( 'elementor/loaded' )){ |
| 23 |
require_once ULTP_PATH.'/addons/elementor/Elementor.php'; |
| 24 |
Elementor_ULTP_Extension::instance(); |
| 25 |
} |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
// Elementor Backend Compatiblity |
| 30 |
add_action( 'elementor/editor/after_register_scripts', 'postx_elementor_widget_scripts' ); |
| 31 |
add_action( 'elementor/editor/after_enqueue_styles', 'postx_elementor_widget_styles' ); |
| 32 |
|
| 33 |
function postx_elementor_widget_styles() { |
| 34 |
wp_register_style('ultp-style-editor', ULTP_URL.'assets/css/style.min.css', array(), ultimate_post()->get_setting('save_version') ); |
| 35 |
wp_enqueue_style('ultp-style-editor'); |
| 36 |
} |
| 37 |
|
| 38 |
function postx_elementor_widget_scripts() { |
| 39 |
wp_register_script('ultp-script-editor', ULTP_URL.'assets/js/ultp.min.js', array('jquery'), ultimate_post()->get_setting('save_version'), true); |
| 40 |
wp_enqueue_script('ultp-script-editor'); |
| 41 |
wp_localize_script('ultp-script-editor', 'ultp_data_frontend', array( |
| 42 |
'url' => ULTP_URL, |
| 43 |
'ajax' => admin_url('admin-ajax.php'), |
| 44 |
'security' => wp_create_nonce('ultp-nonce') |
| 45 |
)); |
| 46 |
} |