custom_register没有显示在前端

时间:2019-02-10 09:01:53

标签: wordpress wordpress-rest-api

我正在m WordPress上使用WordPress API,我检查了几次代码看起来也不错并且工作正常,但是当我更改设置时前端没有任何显示。我认为可能是由于我的主题名称引起的,但是我检查了一下是否正确

function mytheme_customize_register( $wp_customize )
    {



    //All our sections, settings, and controls will be added here
       $wp_customize->add_section('mytheme_color_scheme', array(
            'title'    => __(

'Color Scheme', 'mytheme'),
        'description' => '',
        'priority' => 120,
));

//  =============================
//  = Text Input                =
//  =============================
$wp_customize->add_setting('mytheme_theme_options[text_test]', array(
    'default'        => 'value_xyz',
    'capability'     => 'edit_theme_options',
    'type'           => 'url',

));

$wp_customize->add_control('mytheme_text_test', array(
    'label'      => __('Text Test', 'mytheme'),
    'section'    => 'mytheme_color_scheme',
    'settings'   => 'mytheme_theme_options[text_test]',
));
}
add_action( 'customize_register', 'mytheme_customize_register' );

//to show output I use

<?php echo get_theme_mod( 'text_test'); ?>

0 个答案:

没有答案