Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 需要帮助添加WordPress短代码到我的css页面吗 #投资焦点英雄。jumbotron{ 背景:/*顶部,透明红色,伪装成渐变*/线性渐变(rgba(255,255,255,0.05),rgba(0,0,0,0.85)),/*底部,图像*/url(“_Php_Css_Wordpress_Shortcode - Fatal编程技术网

Php 需要帮助添加WordPress短代码到我的css页面吗 #投资焦点英雄。jumbotron{ 背景:/*顶部,透明红色,伪装成渐变*/线性渐变(rgba(255,255,255,0.05),rgba(0,0,0,0.85)),/*底部,图像*/url(“

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('

将文件扩展名更改为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('<?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" />