【发布时间】:2015-05-07 10:05:42
【问题描述】:
我正在尝试为我的 wordpress 主题获取自定义标题。
$args = array(
'width' => 1920,
'height' => 800,
'default-image' => get_template_directory_uri() . '/images/header.jpg',
'uploads' => true,
); add_theme_support( 'custom-header', $args );
将其添加到我的functions.php中,并希望默认图像是在管理员中没有设置图像时显示的图像。
但它不会显示任何内容。 “img src”为空。
尝试上传图片然后显示,可能是什么问题?
<img src="<?php echo header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />
在我的 front-page.php 中使用它(宽度和高度设置正确)。
【问题讨论】:
标签: php html css wordpress wordpress-theming