Php WordPress主题定制器:如何创建深层面板
有没有办法在主题定制器中创建深层次子面板(如植物的根)?我一直在开发的主题似乎更复杂。我认为,如果我们能够创建深层次的子面板,我们的定制页面将不会显得凌乱,我们的用户将更容易定制主题,我们将能够使更复杂的WordPress主题更容易。下面的图片描述了我的想法 不幸的是,我已经尝试过搜索这个主题,但我只能在主题定制器中找到创建单级面板的方法,无法找到使子面板更深的方法。你能为我的生活遮光吗 更新:下面的代码是我用来创建面板和控件的一些代码,比如图像#1,它是单层面板。它们都很好用Php WordPress主题定制器:如何创建深层面板,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,有没有办法在主题定制器中创建深层次子面板(如植物的根)?我一直在开发的主题似乎更复杂。我认为,如果我们能够创建深层次的子面板,我们的定制页面将不会显得凌乱,我们的用户将更容易定制主题,我们将能够使更复杂的WordPress主题更容易。下面的图片描述了我的想法 不幸的是,我已经尝试过搜索这个主题,但我只能在主题定制器中找到创建单级面板的方法,无法找到使子面板更深的方法。你能为我的生活遮光吗 更新:下面的代码是我用来创建面板和控件的一些代码,比如图像#1,它是单层面板。它们都很好用 $wp_cus
$wp_customize->add_panel('panel1',
array(
'title' => 'Panel 1',
'priority' => 1,
)
);
$wp_customize->add_section( 'section1',
array(
'title' => 'This is section 1',
'priority' => 1,
'panel' => 'panel1'
)
);
$wp_customize->add_setting('field1', array('default' => 'default text'));
$wp_customize->add_control('field1', array(
'label' => 'Text field',
'section' => 'section1',
'type' => 'text',
)
);
我的问题是,我想创建一个新的面板,让它们粘在另一个面板上,这将使它看起来像根层次结构(图#2)。我认为,如果我们能做一些类似的事情,我们将能够制作更强大的主题定制器。然后我试图实现这个想法,并试图重写我的代码。不幸的是,它没有起作用。请检查下面的一个
$wp_customize->add_panel('panel1',
array(
'title' => 'Panel 1',
'priority' => 1,
)
);
$wp_customize->add_section( 'section1',
array(
'title' => 'This is section 1',
'priority' => 1,
'panel' => 'panel1'
)
);
$wp_customize->add_setting('field1', array('default' => 'default text'));
$wp_customize->add_control('field1', array(
'label' => 'Text field',
'section' => 'section1',
'type' => 'text',
)
);
// I used the code below with a little hope that it will help me accomplish my idea, but it didn't work T^T.
$wp_customize->add_panel('panel1_1',
array(
'title' => 'Panel 1.1',
'priority' => 2,
'panel' => 'panel1' // I tried adding this line of code in order to let it depend on another panel
)
);
$wp_customize->add_section( 'section1_1',
array(
'title' => 'This is section 1',
'priority' => 1,
'panel' => 'panel1_1'
)
);
$wp_customize->add_setting('field1_1', array('default' => 'default text'));
$wp_customize->add_control('field1_1', array(
'label' => 'Text field',
'section' => 'section1_1',
'type' => 'text',
)
);
你能给我一个解决方案吗?我不知道如何使面板看起来像根层次结构。任何帮助都将不胜感激:)