admin管理员组

文章数量:1414628

Here is my code in functions.php

$custom_header_args=array(
    'default-image'          => '',
    'width'                  => 500,
    'height'                 => 500,
    'flex-height'            => true,
    'flex-width'             => true,
    'uploads'                => true,
    'random-default'         => false,
    'header-text'            => true,
    'default-text-color'     => '',
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);
add_theme_support( 'custom-header' ,$custom_header_args);

And here is my code in header.php

<img src="<?php header_image(); ?>" height="<?php get_custom_header()->height ?>" width="<?php get_custom_header()->width; ?>" alt="">
<?php wp_nav_menu( array('theme_location'  => 'primary') ); ?>

My question is it does not change the height and width of my header image. What is the problem?

Here is my code in functions.php

$custom_header_args=array(
    'default-image'          => '',
    'width'                  => 500,
    'height'                 => 500,
    'flex-height'            => true,
    'flex-width'             => true,
    'uploads'                => true,
    'random-default'         => false,
    'header-text'            => true,
    'default-text-color'     => '',
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
);
add_theme_support( 'custom-header' ,$custom_header_args);

And here is my code in header.php

<img src="<?php header_image(); ?>" height="<?php get_custom_header()->height ?>" width="<?php get_custom_header()->width; ?>" alt="">
<?php wp_nav_menu( array('theme_location'  => 'primary') ); ?>

My question is it does not change the height and width of my header image. What is the problem?

Share Improve this question edited Sep 13, 2019 at 10:08 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Sep 13, 2019 at 4:34 Lucifer LeviLucifer Levi 932 silver badges11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You have forgot to do "echo" the Height & Width in Image code. Your Header code should like below.

<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="">
<?php wp_nav_menu( array('theme_location'  => 'primary') ); ?>

check this reference https://codex.wordpress/Custom_Headers

本文标签: My custom header does not change the header image height and width