php - 需要帮助将 WordPress 短代码添加到我的 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%;
}
解决方案
将文件的扩展名更改为 php,然后更新链接标签的文件路径,您可以在其中加载标题中的 CSS 文件。
因此,您的链接标签将从以下位置开始:
<link href="css/styles.css" rel="stylesheet" type="text/css" />
对此:
<link href="css/styles.php" rel="stylesheet" type="text/css" />
这样 CSS 就由服务器运行了!
推荐阅读
- c++ - 函数调用后指针正在更改其地址
- r - 使用 lapply 循环遍历数据框的行并从数据框中的存储值中命名对象
- selenium - 如何为硒网格设置自定义浏览器版本?
- javascript - Apollo 查询触发并导致在 URL 更改时在 useContext 中重新呈现
- python - 使用 Python Paramiko exec_command 执行命令时未完成
- swift - PropertyListEncoder 忽略 .binary outputFormat
- amazon-web-services - S3 BucketSizeBytes 指标是否显示字节或字节/天?
- macos - NSCollectionViewCompositionalLayout 可以支持“生长细胞”吗
- reactjs - 在 react-select 中使用自定义样式时,为什么“没有重载匹配此调用”TypeScript 错误?
- java - jOOQ:在 select 语句之前设置 where 条件