Skip to content

Instantly share code, notes, and snippets.

@wpbean
Created May 27, 2018 10:18
Show Gist options
  • Save wpbean/10c19016c812225b9a73a8aea79a6f4f to your computer and use it in GitHub Desktop.
Save wpbean/10c19016c812225b9a73a8aea79a6f4f to your computer and use it in GitHub Desktop.
Elementor adding new control
<?php
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'section' && $section_id == 'section_layout' ){
$section->add_control(
'wpb_section_padding',
[
'label' => _x( 'Section Padding (top & bottom)', 'Section Control', 'wpb-plugins' ),
'type' => Elementor\Controls_Manager::SELECT,
'options' => [
'default' => _x( 'Default', 'Section Control', 'wpb-plugins' ),
'no' => _x( 'No', 'Section Control', 'wpb-plugins' ),
'medium' => _x( 'Medium', 'Section Control', 'wpb-plugins' ),
'large' => _x( 'Large', 'Section Control', 'wpb-plugins' ),
],
'default' => 'large',
'render_type' => 'ui',
'prefix_class' => 'wpb-section-padding-',
'label_block' => true,
'hide_in_inner' => true,
]
);
}
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment