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 badges1 Answer
Reset to default 0You 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
版权声明:本文标题:My custom header does not change the header image height and width 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745161519a2645461.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论