从wordpress检索customize_register设置



我正在尝试检索我启动的一些自定义程序设置。

function notop_customize_register( $wp_customize ) {
    $wp_customize->add_section( 'header_images', array(
        'title' => 'Header Images',
        'priority' => 2,
        'description' => "Add images with links to be redirected to when the images are clicked",
    ) );
    // Add color scheme setting and control.
    $wp_customize->add_setting( 'header_image_1_setting', array(
        'capability'        => 'edit_theme_options',
        'type'           => 'option',
    ) );

    $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize,'header_image_1_control', array(
        'label'    => __( 'Import Image', 'notop' ),
        'section'  => 'header_images',
        'settings' => 'header_image_1_setting',
    ) ) );
}
add_action( 'customize_register', 'notop_customize_register' );

如何获取header_image_1的url?

我想可能是get_theme_mod('header_image_1_setting'(;但到目前为止,这还没有奏效。此外,我不确定我是否真的应该在索引中的某个地方调用customize_register文件,或者它是否可以。

cale_b的注释就是答案。

get_option('header_image_1_setting')

=>http://...

最新更新