WordPress:添加主题支持

我正在尝试为WordPress网站添加”自定义背景”主题挂钩。

在我的函数文件中, 我添加了一个主题文件夹

add_theme_support( 'Custom Background', array (
    'background-color' => '#000000', 'background-size' => 'cover'
) );

这似乎可行, 因为进入WordPress仪表板->外观->背景, 我可以添加图像并将其显示在定制程序空间中。但是当我实际转到页面本身时, 它显示了一个空白的白色背景。

我是否需要在” .php”文件中添加其他代码?以前这里也有类似的帖子:https://wordpress.stackexchange.com/questions/259315/custom-background-image-not-showing-up

但是我认为这不再起作用, 或者我的流程做错了。


#1


根据法典样本, 你需要此格式

$args = array(
    'default-image' => 'https://cdn.pixabay.com/photo/2015/12/01/20/28/road-1072823__340.jpg', 'default-size' => 'cover', );
add_theme_support( 'custom-background', $args );

#2


感谢你的回覆。我发现问题出在我的代码上。并不是我的代码格式不正确, 但是我忘记了输入

<body <?php body_class();?>>

无论我在哪里放置标签。

来源:

https://www.srcmini02.com/64190.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37500.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?