Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oooh-boi/0e8bd73deeaa84582d78071b1929ba50 to your computer and use it in GitHub Desktop.
Save oooh-boi/0e8bd73deeaa84582d78071b1929ba50 to your computer and use it in GitHub Desktop.
Elementor coding tips tricks. (Exclude & Include example for elementor group control)
<?php
/*
* Exclude & Include in group control
*/
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'item_background',
'label' => __( 'Background', 'happy-addons-pro' ),
'types' => [ 'classic', 'gradient' ],
''exclude' => [ 'image' ], // remove image bg option
'selector' => '{{WRAPPER}} .post-item',
]
);
$this->add_group_control(
Group_Control_Background::get_type(),
[
'name' => 'item_background_image',
'types' => [ 'classic', 'gradient' ],
'exclude' => [
'classic' => 'image' // remove image bg option
],
'selector' => '{{WRAPPER}} .carousel-item',
]
);
$this->add_group_control(
Group_Control_Border::get_type(),
[
'name' => 'item_border',
'label' => __( 'Border', 'happy-addons-pro' ),
'selector' => '{{WRAPPER}} .post-item',
'exclude' => ['color'], //remove border color
]
);
$this->add_group_control(
Group_Control_Image_Size::get_type(),
[
'name' => 'featured_image',
'default' => 'thumbnail',
'exclude' => [
'custom', //remove custom option
]
]
);
$repeater->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'text_typography',
'label' => __('Typography', 'happy-addons-pro'),
'exclude' => [
'font_size',
'line_height',
'letter_spacing',
'text_transform',
],
'default' => [
'font_family' => [ '' ],
'font_weight' => ['']
],
'selector' => '{{WRAPPER}}.item-number > {{CURRENT_ITEM}}, {{WRAPPER}} .item-number > {{CURRENT_ITEM}} i, {{WRAPPER}} .item-number > {{CURRENT_ITEM}} em',
]
);
$repeater->add_control(
'badge_icon',
[
'label' => __( 'Badge Icon', 'text-domain' ),
'label_block' => false,
'type' => Controls_Manager::ICONS,
'skin' => 'inline',
'exclude_inline_options' => [ 'svg' ],
]
);
$this->add_group_control(
Group_Control_Box_Shadow::get_type(),
[
'name' => 'badge_box_shadow',
'exclude' => [
'box_shadow_position',
],
'selector' => '{{WRAPPER}} .post-item',
]
);
$this->add_responsive_control(
'close_button_align',
[
'label' => __( 'Alignment', 'essential-addons-elementor' ),
'type' => Controls_Manager::CHOOSE,
'default' => 'left',
'options' => [
'left' => [
'title' => __( 'Left', 'essential-addons-elementor' ),
'icon' => 'eicon-h-align-left',
],
'right' => [
'title' => __( 'Right', 'essential-addons-elementor' ),
'icon' => 'eicon-h-align-right',
],
],
'selectors_dictionary' => [
'left' => 'order: -1;',
'right' => '',
],
'selectors' => [
'.xyzoc-offcanvas-content-{{ID}} .xyzoc-offcanvas-close-{{ID}}' => '{{VALUE}}', //here ID is widget id
],
'prefix_class' => 'item-align-',
]
);
$this->add_responsive_control(
'curved_body_translateZ',
[
'label' => __( 'Translate Z', 'essential-addons-elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => ['px'],
'range' => [
'px' => [
'min' => -10000,
'max' => 10000,
'step' => 1,
],
],
'default' => [
'unit' => 'px',
'size' => -400,
],
'selectors' => [ //.xyzoc-offcanvas-container
'(desktop).xyzoc-offcanvas-content-open.xyzoc-offcanvas-content-{{ID}}-open .xyzoc-offcanvas-container' => ' transform: rotateY({{curved_body_rotateY.SIZE || 50}}deg) translateZ({{curved_body_translateZ.SIZE || -400}}px);',
'(tablet).xyzoc-offcanvas-content-open.xyzoc-offcanvas-content-{{ID}}-open .xyzoc-offcanvas-container' => ' transform: rotateY({{curved_body_rotateY_tablet.SIZE || 50}}deg) translateZ({{curved_body_translateZ_tablet.SIZE || -400}}px);',
'(mobile).xyzoc-offcanvas-content-open.xyzoc-offcanvas-content-{{ID}}-open .xyzoc-offcanvas-container' => ' transform: rotateY({{curved_body_rotateY_mobile.SIZE || 50}}deg) translateZ({{curved_body_translateZ_mobile.SIZE || -400}}px);',
],
]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment