简体   繁体   English

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

[英]Need help adding WordPress shortcode to my css page

#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%;
}

Change the extension of the file to php, then update your link tag's file path where you load in the CSS file in your header. 将文件扩展名更改为php,然后更新链接标记的文件路径,该路径将在标头的CSS文件中加载。

So your link tag would go from this: 因此,您的链接标记将来自此:

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

To this: 对此:

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

This way the CSS gets run by the server! 这样CSS可以由服务器运行!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM