php - 需要帮助将 WordPress 短代码添加到我的 css 页面

标签 php css wordpress shortcode

#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,然后更新您在 header 中加载 CSS 文件的链接标记的文件路径。

所以你的链接标签会从这个开始:

<link href="css/styles.css" rel="stylesheet" type="text/css" />

对此:

<link href="css/styles.php" rel="stylesheet" type="text/css" />

这样 CSS 就可以由服务器运行了!

关于php - 需要帮助将 WordPress 短代码添加到我的 css 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51365671/

相关文章:

javascript - Pusher 私有(private)还是公共(public)?

php - 在 cakephp 中强制刷新修改后的 JS 和 CSS 文件

mysql - 使用大量与 wp_postmeta(键/值表)的内部联接来改进查询

html - CSS 中的 Y 轴滚动?

css - 设置 flexbox 顺序属性

wordpress - 如何在 WordPress 主题中引入管理栏?

javascript - 如何将最后一类元素复制到 jQuery 中的另一个元素?

php - 使MySQL自增id(re)从1开始

PHP 表单 : prevent outside posters with tokens

javascript - 为选中的每个复选框添加和删除隐藏输入