【问题标题】:Elementor Widget - repeater responsive margin control doesn't workElementor Widget - 中继器响应边距控制不起作用
【发布时间】:2020-08-05 11:57:06
【问题描述】:

我在 Elementor 小部件中创建中继器响应式边距控制时遇到了一些麻烦。我在小部件中动态创建项目,我需要此字段才能更改我的项目在小部件中的位置。

我下面的代码不起作用。

    // Content section
    $this->start_controls_section(
        'content_section',
        [
            'label' => __( 'Content', 'watt-elements' ),
            'tab' => Controls_Manager::TAB_CONTENT,
        ]
    );

    ...

    $repeater = new \Elementor\Repeater();


    $repeater->add_responsive_control(
       'feature_margin',
          [
             'label' => __( 'Feature margin', 'plugin-name' ),
             'type' => \Elementor\Controls_Manager::DIMENSIONS,
             'size_units' => [ 'px', 'em', '%' ],
             'selectors' => [
             '{{WRAPPER}} {{CURRENT_ITEM}} .feature-tip' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
          ],



    ]);

    ...

    $this->end_controls_section();

【问题讨论】:

  • 问题解决了吗?在这里,您需要将带有 js 每个函数的动态类添加到 CURRENT_ITEM。然后你可以从 Elementor 编辑器中添加 css 样式。

标签: controls responsive elementor


【解决方案1】:

我知道这是一个迟到的回复,但应该对某人有所帮助。 您需要为 {{CURRENT_ITEM}} 添加以下动态类。

class="elementor-repeater-item-<?php echo $item['_id']; ?>"

【讨论】:

  • 感谢您的回答,是的,我已经通过仔细阅读 Elementor 文档解决了这个问题。
猜你喜欢
  • 2023-01-27
  • 2022-08-04
  • 1970-01-01
  • 2019-01-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-21
相关资源
最近更新 更多