Skip to content

Instantly share code, notes, and snippets.

@JeffAspen
Created October 1, 2018 15:21
Show Gist options
  • Save JeffAspen/dbd885e35a0333fc8edee1161520c765 to your computer and use it in GitHub Desktop.
Save JeffAspen/dbd885e35a0333fc8edee1161520c765 to your computer and use it in GitHub Desktop.
Elementor Section Control Padding
<?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