【问题标题】:Wordpress + Divi: Custom Section ToggleWordpress + Divi:自定义部分切换
【发布时间】:2021-07-14 01:54:38
【问题描述】:

我有一个子主题从 Divi 父主题编辑 main-structure-elements.php 文件。我试图通过将其移动到子主题并在那里进行更改来覆盖此文件,以及修改 functions.php 文件以要求该文件,但仍然没有运气。

我只需要在 Divi 部分添加一个切换,以添加一个 CSS 过滤器。这是我在 main-structure-elements.php 文件中编写的代码,它在主 divi 文件中运行良好,但如果仅添加到子主题文件中则无法识别。

public function get_fields() {
    $fields = array(
        
        'fullpage_height'              => array(
            'label'            => esc_html__( 'Enable Fullpage', 'et_builder' ),
            'type'             => 'yes_no_button',
            'option_category'  => 'configuration',
            'options'          => array(
                'off' => et_builder_i18n( 'No' ),
                'on'  => et_builder_i18n( 'Yes' ),
            ),
            'default'          => 'off',
            'description'      => esc_html__( 'Here you can select whether or not your page should have Full Height enabled. This must be enabled on all sections to function', 'et_builder' ),
            'tab_slug'         => 'advanced',
            'toggle_slug'      => 'layout',
            'default_on_front' => 'off',
        ),

此代码稍后会在同一文件中触发此代码。

if ( 'on' === $fullpage_height ) {
        $this->add_classname( 'fullpage-vertical' );
    }

我已经为此工作了几天,任何见解都可以挽救生命

【问题讨论】:

    标签: php wordpress function divi


    【解决方案1】:

    您是否尝试使用插件“代码片段”将此代码作为 sn-p 运行?也许这样代码就可以正常工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-30
      • 1970-01-01
      • 2016-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-11
      相关资源
      最近更新 更多