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

时间:2018-07-16 15:47:53

标签: 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%;
}

1 个答案:

答案 0 :(得分:0)

将文件的扩展名更改为php,然后更新链接标记的文件路径,该路径将在标头的CSS文件中加载。

因此您的链接标记将来自此:

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

对此:

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

通过这种方式CSS由服务器运行!