我在主题中使用了redux框架,并通过使用文件" customizer_section.php"扩展WP_Customize_Section来自定义我的主题。
在定义我的选项时,我将一个部分定义为:
Redux::setSection($myTheme_opt_name, array(
'id' => 'my-th-shortcode-subsec-shortcodes-blog-tab',
'title' => __('Blog', 'myTheme'),
'subsection' => true,
'class' => MyCSSClass,
'fields' => array(
array(
'subtitle' => __('Controls the color of the icon circle in blog alternate and recent posts layouts.', 'myTheme'),
'id' => 'my-th_shortcode_blog_icon_circle_color',
'compiler' => true,
'type' => 'color',
'title' => __('Blog Icon Circle Color', 'myTheme'),
'default' => '#eef0f2',
),
),
)
);
在我们自己的customizer_section.php中我想在我自己的代码块中的选项中定义的类中添加
protected function render_fallback() {
$classes = 'accordion-section redux-section control-section control-section-' . $this->type;
?>
<li id="accordion-section-<?php echo esc_attr($this->id); ?>" class="<?php echo esc_attr($classes); ?>">
<h3 class="accordion-section-title" tabindex="0">
<?php
echo wp_kses($this->title, array(
'em' => array(),
'i' => array(),
'strong' => array(),
'span' => array(
'class' => array(),
'style' => array(),
),
));
?>
</h3>
答案 0 :(得分:0)
ok想出来......我使用下面的代码来获取一个部分的类并在li类中使用它
$this->class_name = isset($this->section['class']) ? $this->section['class'] : '';