Save
This commit is contained in:
1
wp-content/plugins/elementor-addon/assets/css/main.css
Normal file
1
wp-content/plugins/elementor-addon/assets/css/main.css
Normal file
@@ -0,0 +1 @@
|
||||
.elementor-vertical-separator{display:flex;align-items:center;height:100%}.elementor-vertical-separator__line{width:1px;height:100px;background:#000}/*# sourceMappingURL=main.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["main.scss"],"names":[],"mappings":"AAAA,8BACC,YAAA,CACA,kBAAA,CACA,WAAA,CAGD,oCACC,SAAA,CACA,YAAA,CACA,eAAA","file":"main.css"}
|
||||
11
wp-content/plugins/elementor-addon/assets/css/main.scss
Normal file
11
wp-content/plugins/elementor-addon/assets/css/main.scss
Normal file
@@ -0,0 +1,11 @@
|
||||
.elementor-vertical-separator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.elementor-vertical-separator__line {
|
||||
width: 1px;
|
||||
height: 100px;
|
||||
background: #000;
|
||||
}
|
||||
60
wp-content/plugins/elementor-addon/elementor-addon.php
Normal file
60
wp-content/plugins/elementor-addon/elementor-addon.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Elementor Addon
|
||||
* Description: Simple hello world widgets for Elementor.
|
||||
* Version: 1.0.0
|
||||
* Author: Elementor Developer
|
||||
* Author URI: https://developers.elementor.com/
|
||||
* Text Domain: elementor-addon
|
||||
*
|
||||
* Requires Plugins: elementor
|
||||
* Elementor tested up to: 3.21.0
|
||||
* Elementor Pro tested up to: 3.21.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register widget files
|
||||
*/
|
||||
function register_hello_world_widget( $widgets_manager ) {
|
||||
require_once( __DIR__ . '/widgets/vertical-separator.php' );
|
||||
|
||||
$widgets_manager->register( new \Elementor_Vertical_Separator() );
|
||||
}
|
||||
add_action( 'elementor/widgets/register', 'register_hello_world_widget' );
|
||||
|
||||
/**
|
||||
* Register scripts/styles only.
|
||||
* Do not enqueue them globally.
|
||||
*/
|
||||
function elementor_addon_register_assets() {
|
||||
$css_path = plugin_dir_path( __FILE__ ) . 'assets/css/main.css';
|
||||
$css_url = plugin_dir_url( __FILE__ ) . 'assets/css/main.css';
|
||||
$css_ver = file_exists( $css_path ) ? filemtime( $css_path ) : '1.0.0';
|
||||
|
||||
$js_path = plugin_dir_path( __FILE__ ) . 'assets/js/main.js';
|
||||
$js_url = plugin_dir_url( __FILE__ ) . 'assets/js/main.js';
|
||||
$js_ver = file_exists( $js_path ) ? filemtime( $js_path ) : '1.0.0';
|
||||
|
||||
// Widget CSS
|
||||
wp_register_style(
|
||||
'elementor-addon-main-css',
|
||||
$css_url,
|
||||
[],
|
||||
$css_ver
|
||||
);
|
||||
|
||||
// Widget JS
|
||||
wp_register_script(
|
||||
'elementor-addon-main-js',
|
||||
$js_url,
|
||||
[ 'jquery' ],
|
||||
$js_ver,
|
||||
true
|
||||
);
|
||||
}
|
||||
add_action( 'elementor/frontend/after_register_styles', 'elementor_addon_register_assets' );
|
||||
add_action( 'elementor/frontend/after_register_scripts', 'elementor_addon_register_assets' );
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use Elementor\Controls_Manager;
|
||||
|
||||
class Elementor_Vertical_Separator extends \Elementor\Widget_Base {
|
||||
|
||||
public function get_name() {
|
||||
return 'Vertical_Separator';
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return esc_html__( 'Vertical Separator', 'elementor-addon' );
|
||||
}
|
||||
|
||||
public function get_icon() {
|
||||
return 'eicon-code';
|
||||
}
|
||||
|
||||
public function get_categories() {
|
||||
return [ 'basic' ];
|
||||
}
|
||||
|
||||
public function get_keywords() {
|
||||
return [ 'vertical', 'separator' ];
|
||||
}
|
||||
|
||||
public function get_style_depends() {
|
||||
return [ 'elementor-addon-main-css' ];
|
||||
}
|
||||
|
||||
public function get_script_depends() {
|
||||
return [ 'elementor-addon-main-js' ];
|
||||
}
|
||||
|
||||
protected function register_controls() {
|
||||
$this->start_controls_section(
|
||||
'section_setting',
|
||||
[
|
||||
'label' => esc_html__( 'Settings', 'elementor' ),
|
||||
'tab' => Controls_Manager::TAB_CONTENT,
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_control(
|
||||
'line_color',
|
||||
[
|
||||
'label' => esc_html__( 'Color', 'elementor-addon' ),
|
||||
'type' => Controls_Manager::COLOR,
|
||||
'default' => '#000000',
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-vertical-separator__line' => 'background: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'line_thickness',
|
||||
[
|
||||
'label' => esc_html__( 'Thickness', 'elementor-addon' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 1,
|
||||
'max' => 20,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'size' => 1,
|
||||
'unit' => 'px',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-vertical-separator__line' => 'width: {{SIZE}}{{UNIT}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'line_height',
|
||||
[
|
||||
'label' => esc_html__( 'Height', 'elementor-addon' ),
|
||||
'type' => Controls_Manager::SLIDER,
|
||||
'size_units' => [ 'px', '%' ],
|
||||
'range' => [
|
||||
'px' => [
|
||||
'min' => 10,
|
||||
'max' => 600,
|
||||
],
|
||||
'%' => [
|
||||
'min' => 10,
|
||||
'max' => 100,
|
||||
],
|
||||
],
|
||||
'default' => [
|
||||
'size' => 100,
|
||||
'unit' => 'px',
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-vertical-separator__line' => 'height: {{SIZE}}{{UNIT}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->add_responsive_control(
|
||||
'line_alignment',
|
||||
[
|
||||
'label' => esc_html__( 'Alignment', 'elementor-addon' ),
|
||||
'type' => Controls_Manager::CHOOSE,
|
||||
'default' => 'center',
|
||||
'options' => [
|
||||
'flex-start' => [
|
||||
'title' => esc_html__( 'Left', 'elementor-addon' ),
|
||||
'icon' => 'eicon-text-align-left',
|
||||
],
|
||||
'center' => [
|
||||
'title' => esc_html__( 'Center', 'elementor-addon' ),
|
||||
'icon' => 'eicon-text-align-center',
|
||||
],
|
||||
'flex-end' => [
|
||||
'title' => esc_html__( 'Right', 'elementor-addon' ),
|
||||
'icon' => 'eicon-text-align-right',
|
||||
],
|
||||
],
|
||||
'selectors' => [
|
||||
'{{WRAPPER}} .elementor-vertical-separator' => 'justify-content: {{VALUE}};'
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->end_controls_section();
|
||||
}
|
||||
|
||||
protected function render() {
|
||||
?>
|
||||
<div class="elementor-vertical-separator">
|
||||
<span class="elementor-vertical-separator__line"></span>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user