如何在wordpress中的style.min.css的head标签内填充缓存? [英] How to bust cache within head tag for style.min.css in wordpress?

查看:137
本文介绍了如何在wordpress中的style.min.css的head标签内填充缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); echo '?ver=' . filemtime( get_stylesheet_directory() . '/style.min.css'); ?>" media="screen" />



保持返回style.css。



如何我让它返回style.min.css?提醒:我希望能够在head标签内执行此操作,而不是在函数内执行此操作。谢谢



我尝试了什么:



我试过了/>


Keeps returning style.css.

How do I make it return style.min.css? Reminder: I want to be able to do this within the head tag, not within functions. Thanks

What I have tried:

I have tried

<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); echo '?ver=' . filemtime( get_stylesheet_url() . '/style.min.css'); ?>" media="screen" />



用'get_stylesheet_url'替换'get_stylesheet_directory'肯定不起作用,它删除了< link>


Replacing 'get_stylesheet_directory' with 'get_stylesheet_url' definitely did not work, it erased everything underneath the <link>

推荐答案





bloginfo('stylesheet_url')将返回主题的样式表路径,如

http://example.com/wp-content/themes/YOUR_ACTIVE_THEME/style.css



但每次获得样式的filemtime(文件修改时间)。 min.css文件。而不是这样你应该写下面的代码:

Hi,

bloginfo('stylesheet_url') will return theme's stylesheet path like
http://example.com/wp-content/themes/YOUR_ACTIVE_THEME/style.css

But everytime you are getting the filemtime(file modified time) of style.min.css file. Instead of this you should write the following code:
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); echo '?ver=' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" media="screen" />





现在修改style.css文件时它必须工作。



希望这对您有用!



Now it must work when you modify your style.css file.

Hope this will work for you!


您好,



bloginfo('stylesheet_url ')将返回style.css文件的主题样式表路径而不是style.min.css文件,如果要使用style.min.css文件,则可以使用以下代码:



Hi,

bloginfo('stylesheet_url') will return theme's stylesheet path of style.css file not style.min.css file, if you want to use the style.min.css file then you can use the following code:

<link rel="stylesheet" type="text/css" href="<?php echo bloginfo('stylesheet_directory').'/style.min.css'; echo '?ver=' . filemtime( get_stylesheet_directory() . '/style.min.css'); ?>" media="screen" />


这篇关于如何在wordpress中的style.min.css的head标签内填充缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆