admin管理员组文章数量:1328001
I have added a section in my customizer to upload a background image for my main site. I am calling it here:
.header_wrapper{
background:url('<?php echo get_theme_mod( 'header_image_uploaded', '..jpg' ); ?>') no-repeat center center fixed;
It is not showing up.
Here is the code for my customizer functions
function uwm_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'header_image' , array(
'default' => '.jpg',) );
$wp_customize->add_section( 'main_header_image' , array(
'title' => __( 'Choose Your Main Image', 'uwm' ),) );
$wp_customize->add_control(
new WP_Customize_Upload_Control(
$wp_customize,
'header_image_uploaded',
array(
'label' => __( 'Main Image Upload', 'uwm' ),
'section' => 'main_header_image',
'settings' => 'header_image',) ) );
}add_action( 'customize_register', 'uwm_customize_register' );
Any help would be greatly appreciated.
I have added a section in my customizer to upload a background image for my main site. I am calling it here:
.header_wrapper{
background:url('<?php echo get_theme_mod( 'header_image_uploaded', 'http://www.unitedwayofmilford/wp-content/uploads/2020/03/Canva-Lending-a-helping-hand..jpg' ); ?>') no-repeat center center fixed;
It is not showing up.
Here is the code for my customizer functions
function uwm_customize_register( $wp_customize ) {
$wp_customize->add_setting( 'header_image' , array(
'default' => 'http://www.unitedwayofmilford/wp-content/uploads/2020/03/Canva-Lending-a-helping-hand.jpg',) );
$wp_customize->add_section( 'main_header_image' , array(
'title' => __( 'Choose Your Main Image', 'uwm' ),) );
$wp_customize->add_control(
new WP_Customize_Upload_Control(
$wp_customize,
'header_image_uploaded',
array(
'label' => __( 'Main Image Upload', 'uwm' ),
'section' => 'main_header_image',
'settings' => 'header_image',) ) );
}add_action( 'customize_register', 'uwm_customize_register' );
Any help would be greatly appreciated.
Share Improve this question asked Jul 20, 2020 at 15:09 user2565143user2565143 1 01 Answer
Reset to default 0The value of the field will be the ID of the uploaded attachment. Not an image URL. You will need to use wp_get_attachment_image_url()
to get the URL.
echo wp_get_attachment_image_url( get_theme_mod( 'header_image_uploaded' ), 'full' );
本文标签: Image Uploaded To Customizer Not Displaying
版权声明:本文标题:Image Uploaded To Customizer Not Displaying 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742247504a2440127.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论