megumi/theme_customizer_control

WordPress主题自定义控制

dev-master 2013-11-09 19:45 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:24:30 UTC


README

主题自定义控制的类。
这个类允许在表单字段前后使用HTML。

如何在项目中安装。

添加如下composer.json

{
    "require": {
        "megumi/theme_customizer_control": "dev-master"
    }
}

在项目中下载此包。

composer install

加载此类。

require(dirname(__FILE__).'/vendor/autoload.php');

示例

$wp_customize->add_section('themename_color_scheme', array(
    'title'    => __('Color Scheme', 'themename'),
    'priority' => 120,
));

$wp_customize->add_setting('setting_name', array(
    'default'        => 'This is default!',
    'capability'     => 'edit_theme_options',
    'type'           => 'option',
));

$wp_customize->add_control(new Megumi_CustomizeControl(
    $wp_customize,
    'uniq_id_for_the_control',
    array(
        'settings' => 'setting_name',
        'label'    => 'This is label',
        'section'  => 'themename_color_scheme',
        'type'     => 'text',
        'choices'  => $themes,
        'label_after' => 'This is label displayed after this control'
    )
));

许可证

GPL2