我试图获得自定义 Headers 到我的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中使用它(正确设置宽度和高度) .
2 回答
我发现你的代码没有任何问题 . 但是你可以在下面尝试这个 . 它总是适合我 .
尝试: