This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function __construct() | |
{ | |
add_action('elementor/init', array($this, 'initiate_elementor_addons')); | |
add_action('elementor/widgets/widgets_registered', array($this, 'addons_widget_register')); | |
add_action('elementor/frontend/after_register_scripts', array($this, 'enqueue_script')); | |
add_action('elementor/frontend/after_register_styles', array($this, 'register_frontend_styles'), 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function addons_widget_register() | |
{ | |
require_once (EC_EXTENTIONS_PATH . 'widgets/hello.php'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function initiate_elementor_addons() | |
{ | |
Elementor\Plugin::instance()->elements_manager->add_category( | |
'my-section', | |
array( | |
'title' => __('Addon Elementor Extentions', 'addon_elementor') | |
), | |
1 | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function enqueue_script(){ | |
wp_register_script( 'general-script', EC_EXTENTIONS_URL . 'assets/js/script.js', [ 'jquery' ], EC_ELEMENTOR_VERSION, true ); | |
} | |
public function register_frontend_styles(){ | |
wp_register_style('general-style', EC_EXTENTIONS_URL . 'assets/css/general.css', array(), EC_ELEMENTOR_VERSION); | |
} | |
public function enqueue_frontend_styles(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Retrieve the widget name. | |
* | |
* @since 1.0.0 | |
* | |
* @access public | |
* | |
* @return string Widget name. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Retrieve the widget title. | |
* | |
* @since 1.0.0 | |
* | |
* @access public | |
* | |
* @return string Widget title. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Retrieve the list of categories the widget belongs to. | |
* | |
* Used to determine where to display the widget in the editor. | |
* | |
* Note that currently Elementor supports only one category. | |
* When multiple categories passed, Elementor uses the first one. | |
* | |
* @since 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Register the widget controls. | |
* | |
* Adds different input fields to allow the user to change and customize the widget settings. | |
* | |
* @since 1.0.0 | |
* | |
* @access protected | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Render the widget output on the frontend. | |
* | |
* Written in PHP and used to generate the final HTML. | |
* | |
* @since 1.0.0 | |
* | |
* @access protected | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example will add a custom "select" drop down to the "Image Box" | |
// This will change the class="" on the rendered image box so we can style the Image Box differently | |
// based on the selected option from the editor. | |
// The class will be "my-image-box-style-blue" or "my-image-box-style-green" based on the selected option. | |
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) { | |
if( $section->get_name() == 'image-box' && $section_id == 'section_image' ){ | |
// we are at the end of the "section_image" area of the "image-box" | |
$section->add_control( |
OlderNewer