Php 无法裁剪wordpress自定义主题中的标题图像
从今天起,我开始学习wordpress的自定义主题开发,目前我遇到了一个问题,当我尝试裁剪标题的图像时出现了错误。下面是示例代码 (1.我已经为标题图像functions.php设置了钩子Php 无法裁剪wordpress自定义主题中的标题图像,php,css,wordpress,image,Php,Css,Wordpress,Image,从今天起,我开始学习wordpress的自定义主题开发,目前我遇到了一个问题,当我尝试裁剪标题的图像时出现了错误。下面是示例代码 (1.我已经为标题图像functions.php设置了钩子 add_theme_support('custom-header'); (2.在header.php中设置图像 <img class="myhead" src="<?php header_image(); ?>" height="<?php get_custom_header(
add_theme_support('custom-header');
(2.在header.php中设置图像
<img class="myhead" src="<?php header_image(); ?>" height="<?php get_custom_header()->height ?>"
width="<?php get_custom_header()->width ?>" alt="">
<img alt="" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" />
“height=”
宽度=“alt=”“>
(3.测试图像是否显示在标题内。图像以实际大小显示
如何在“自定义”中自定义页眉图像?我很想听听您的意见。
flex-width
&flex-height
自动调整
$args = array(
'flex-width' => true,
'width' => 980,
'flex-height' => true,
'height' => 200,
'default-image' => get_template_directory_uri() . '/images/header.jpg',
);
add_theme_support( 'custom-header', $args );
更新你的header.php
<img class="myhead" src="<?php header_image(); ?>" height="<?php get_custom_header()->height ?>"
width="<?php get_custom_header()->width ?>" alt="">
<img alt="" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" />
“width=”“height=”“/>
伸缩宽度
和伸缩高度
可自行调整
$args = array(
'flex-width' => true,
'width' => 980,
'flex-height' => true,
'height' => 200,
'default-image' => get_template_directory_uri() . '/images/header.jpg',
);
add_theme_support( 'custom-header', $args );
更新你的header.php
<img class="myhead" src="<?php header_image(); ?>" height="<?php get_custom_header()->height ?>"
width="<?php get_custom_header()->width ?>" alt="">
<img alt="" src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" />
“width=”“height=”“/>
您使用的主题是什么?您使用的主题是什么?