Skip to content

Instantly share code, notes, and snippets.

@iqbalrony
Last active October 16, 2024 09:13

Revisions

  1. iqbalrony revised this gist Oct 16, 2024. 1 changed file with 37 additions and 0 deletions.
    37 changes: 37 additions & 0 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,30 @@
    'label' => __( 'Border', 'happy-addons-pro' ),
    'selector' => '{{WRAPPER}} .post-item',
    'exclude' => ['color'], //remove border color
    'fields_options' => [
    'border' => [
    'default' => 'solid',
    ],
    'width' => [
    'label' => __( 'Width', 'text-domain' ),
    'allowed_dimensions' => ['top', 'bottom', 'left', 'right'],
    'size_units' => ['px'],
    'default' => [
    'top' => '0',
    'right' => '0',
    'bottom' => '1',
    'left' => '0',
    'isLinked' => false,
    ],
    'selectors' => [
    '{{WRAPPER}} .woocommerce-shipping-calculator :is(select, input, .select2-container)' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}',
    ],
    ],
    'color' => [
    'default' => '#DEDFE2',
    'alpha' => false,
    ],
    ],
    ]
    );

    @@ -191,9 +215,12 @@
    Group_Control_Typography::get_type(),
    [
    'name' => 'content_typography',
    'label' => __( 'Title Typography', 'text-domain' ),
    'exclude' => ['font_family', 'text_decoration', 'font_style'],
    'fields_options' => [
    'typography' => [
    'default' => 'yes'
    //'default' => 'custom'
    ],
    'font_family' => [
    'default' => 'Roboto',
    @@ -202,6 +229,8 @@
    'default' => '', // 100, 200, 300, 400, 500, 600, 700, 800, 900, normal, bold
    ],
    'font_size' => [
    'label' => __( 'Font Size', 'text-domain' ),
    'size_units' => ['px'],
    'default' => [
    'unit' => 'px', // px, em, rem, vh
    'size' => '', // any number
    @@ -217,10 +246,18 @@
    'default' => '', // underline, overline, line-through, none
    ],
    'line_height' => [
    'label' => __( 'Line Height', 'text-domain' ),
    'default' => [
    'unit' => 'px', // px, em
    'size' => '', // any number
    ],
    'size_units' => ['px'],
    'tablet_default' => [
    'unit' => 'px',
    ],
    'mobile_default' => [
    'unit' => 'px',
    ],
    ],
    'letter_spacing' => [
    'default' => [
  2. iqbalrony revised this gist Mar 20, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    'name' => 'item_background',
    'label' => __( 'Background', 'happy-addons-pro' ),
    'types' => [ 'classic', 'gradient' ],
    ''exclude' => [ 'image' ], // remove image bg option
    'exclude' => [ 'image' ], // remove image bg option
    'selector' => '{{WRAPPER}} .post-item',
    ]
    );
  3. iqbalrony revised this gist Sep 22, 2022. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -93,6 +93,7 @@
    'label' => __( 'Alignment', 'essential-addons-elementor' ),
    'type' => Controls_Manager::CHOOSE,
    'default' => 'left',
    'devices' => [ 'desktop', 'tablet', 'mobile' ],
    'options' => [
    'left' => [
    'title' => __( 'Left', 'essential-addons-elementor' ),
  4. iqbalrony revised this gist Oct 7, 2021. 1 changed file with 22 additions and 12 deletions.
    34 changes: 22 additions & 12 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -162,18 +162,28 @@
    );

    $this->add_group_control(
    Group_Control_Box_Shadow::get_type(),
    [
    'name' => 'button_box_shadow',
    'fields_options' => [
    'box_shadow' => [
    'default' => [
    'blur' => 0
    ],
    ],
    ],
    'selector' => '{{WRAPPER}} .ha-creative-btn'
    ]
    Group_Control_Box_Shadow::get_type(),
    [
    'name' => 'box_shadow',
    'fields_options' => [
    'box_shadow_type' => [
    'default' => 'yes', // turn on box shadow by default
    ],
    'box_shadow' => [
    'default' => [
    'color' => '#000000', // any color code
    'horizontal' => '', // any number
    'vertical' => '', // any number
    'blur' => 0, // any number
    'spread' => '', // any number
    ],
    ],
    'box_shadow_position' => [
    'default' => '', // '', inset
    ],
    ],
    'selector' => '{{WRAPPER}} .class',
    ]
    );

    $this->add_group_control(
  5. iqbalrony revised this gist Oct 7, 2021. 1 changed file with 59 additions and 0 deletions.
    59 changes: 59 additions & 0 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -161,4 +161,63 @@
    ]
    );

    $this->add_group_control(
    Group_Control_Box_Shadow::get_type(),
    [
    'name' => 'button_box_shadow',
    'fields_options' => [
    'box_shadow' => [
    'default' => [
    'blur' => 0
    ],
    ],
    ],
    'selector' => '{{WRAPPER}} .ha-creative-btn'
    ]
    );

    $this->add_group_control(
    Group_Control_Typography::get_type(),
    [
    'name' => 'content_typography',
    'fields_options' => [
    'typography' => [
    'default' => 'yes'
    ],
    'font_family' => [
    'default' => 'Roboto',
    ],
    'font_weight' => [
    'default' => '', // 100, 200, 300, 400, 500, 600, 700, 800, 900, normal, bold
    ],
    'font_size' => [
    'default' => [
    'unit' => 'px', // px, em, rem, vh
    'size' => '', // any number
    ],
    ],
    'text_transform' => [
    'default' => '', // uppercase, lowercase, capitalize, none
    ],
    'font_style' => [
    'default' => '', // normal, italic, oblique
    ],
    'text_decoration' => [
    'default' => '', // underline, overline, line-through, none
    ],
    'line_height' => [
    'default' => [
    'unit' => 'px', // px, em
    'size' => '', // any number
    ],
    ],
    'letter_spacing' => [
    'default' => [
    'unit' => 'px',
    'size' => '', // any number
    ],
    ],
    ],
    'selector' => '{{WRAPPER}} .class',
    ]
    );
  6. iqbalrony revised this gist Jun 24, 2021. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -141,4 +141,24 @@
    ]
    );

    // prefix_class option use only in RAW_HTML & HIDDEN control field
    $this->add_control(
    'responsive_description',
    [
    'raw' => __( 'Responsive visibility will take effect only on preview or live page, and not while editing in Elementor.', 'elementor' ),
    'type' => Controls_Manager::RAW_HTML,
    'content_classes' => 'elementor-descriptor',
    ]
    );
    $this->add_control(
    'screen_sm_width',
    [
    'type' => Controls_Manager::HIDDEN,
    'condition' => [
    'screen_sm' => [ 'custom' ],
    ],
    'content_classes' => 'elementor-fasdsf',
    ]
    );


  7. iqbalrony revised this gist Dec 29, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -110,6 +110,7 @@
    'selectors' => [
    '.xyzoc-offcanvas-content-{{ID}} .xyzoc-offcanvas-close-{{ID}}' => '{{VALUE}}', //here ID is widget id
    ],
    'prefix_class' => 'item-align-',
    ]
    );

  8. iqbalrony revised this gist Sep 19, 2020. 1 changed file with 55 additions and 0 deletions.
    55 changes: 55 additions & 0 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -86,3 +86,58 @@
    '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
    ],
    ]
    );

    $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);',
    ],
    ]
    );


  9. iqbalrony revised this gist Aug 13, 2020. No changes.
  10. iqbalrony created this gist Aug 13, 2020.
    88 changes: 88 additions & 0 deletions elementor-tips-tricks.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,88 @@
    <?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',
    ]
    );