从wordpress检索customize_register设置

时间:2015-07-03 20:05:55

标签: wordpress

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

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的网址?

我认为它可能是get_theme_mod('header_image_1_setting');但到目前为止还没有奏效。另外,我不确定我是否真的应该在我的索引中调用customize_register文件,或者它是否正常。

1 个答案:

答案 0 :(得分:0)

cale_b's comment就是答案。

get_option('header_image_1_setting')

=> HTTP:// ...