Skip to content

Instantly share code, notes, and snippets.

@ryanlabelle
Created February 1, 2017 21:12
Show Gist options
  • Save ryanlabelle/c93c7a40f0606a699d69e0ec2f477c52 to your computer and use it in GitHub Desktop.
Save ryanlabelle/c93c7a40f0606a699d69e0ec2f477c52 to your computer and use it in GitHub Desktop.
/* Add Image Stretch Option Control to the Image Gallery Widget */
add_action( 'elementor/element/before_section_end', function( $element, $section_id, $args ) {
/** @var \Elementor\Element_Base $element */
if ( 'image-gallery' === $element->get_name() && 'section_gallery' === $section_id ) {
$element->add_control(
'image_stretch',
[
'label' => __( 'Image Stretch', 'elementor' ),
'type' => \Elementor\Controls_Manager::SELECT,
'default' => 'no',
'options' => [
'no' => __( 'No', 'elementor' ),
'yes' => __( 'Yes', 'elementor' ),
],
]
);
}
}, 10, 3 );
@temsool
Copy link

temsool commented Sep 22, 2018

Hi, can you help me about this? elementor/elementor#5785

@tannerchung
Copy link

Where do you find the names of the elements?

@tannerchung
Copy link

nm, find them at the top of each widget doc: https://code.elementor.com/classes/elementor-widget_image/

@shahmanish877
Copy link

How can I add control to global Site settings? I need to add global color for woocommerce. Any idea how can I implement it?

@alessandroprudencio
Copy link

Thank you men 👏👏 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment