Php 需要帮助添加WordPress短代码到我的css页面吗 #投资焦点英雄。jumbotron{ 背景:/*顶部,透明红色,伪装成渐变*/线性渐变(rgba(255,255,255,0.05),rgba(0,0,0,0.85)),/*底部,图像*/url(“
将文件扩展名更改为php,然后更新链接标签的文件路径,将其加载到头中的CSS文件中 所以你的链接标签应该是这样的:Php 需要帮助添加WordPress短代码到我的css页面吗 #投资焦点英雄。jumbotron{ 背景:/*顶部,透明红色,伪装成渐变*/线性渐变(rgba(255,255,255,0.05),rgba(0,0,0,0.85)),/*底部,图像*/url(“,php,css,wordpress,shortcode,Php,Css,Wordpress,Shortcode,将文件扩展名更改为php,然后更新链接标签的文件路径,将其加载到头中的CSS文件中 所以你的链接标签应该是这样的: #investment-focus-hero .jumbotron { background: /* top, transparent red, faked with gradient */ linear-gradient( rgba(255 , 255, 255, 0.05), rgba(0, 0, 0, 0.85)), /* bottom, image */ url('
#investment-focus-hero .jumbotron {
background: /* top, transparent red, faked with gradient */ linear-gradient( rgba(255 , 255, 255, 0.05), rgba(0, 0, 0, 0.85)), /* bottom, image */ url('<?php echo do_shortcode('[acf field="jumbotron_full_image" post_id="237"]'); ?>');
background-size: 100% 100%;
background-repeat: no-repeat;
padding-top: 37.42%;
}
为此:
<link href="css/styles.css" rel="stylesheet" type="text/css" />
这样,CSS就会由服务器运行!当我添加时,如果您试图在CSS文件中添加短代码,它将永远不会工作。您需要做的是创建一个style.php文件来生成动态CSS,并使用
require\u once(includes/style.php)
(考虑到您将style.php文件放在活动主题的“includes”文件夹中)。
<link href="css/styles.php" rel="stylesheet" type="text/css" />