Custom full width header image not showing up
-
I am building my own custom theme, for WordPress, and I have allowed for the customisation of a header background image. I can successfully change the header image, however when I do so, the header image appears nonexistent from the front end.
Functions.php code:
//home header $wp_customize->add_setting('home_img', array( 'default' => get_template_directory_uri() . '/images/web.jpg', 'transport' => 'refresh', )); $wp_customize->add_section('home_imgs', array( 'title' => __('Home page banner image', 'Will Smith Media'), 'priority' => 30, )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'header_image_control', array( 'label' => __('Home Image', 'Will Smith Media'), 'section' => 'home_imgs', 'settings' => 'home_img', )));functions.php customize css
function customize_css(){ ?> <style type="text/css"> .site-header{ background-image: <?php echo get_theme_mod('home_img'); ?>; width: 100%; height: 200px; display: block; } </style>
The topic ‘Custom full width header image not showing up’ is closed to new replies.