WordPress插件不能想head标签中自动插入css或js文件可能是由于wp_head()函数导致的,新手站长网分享:
插件不能自动插入css或js的解决方法
WordPress有的插件需要向头部的head标签中插入css或js文件,例如:Crayon Syntax Highlighter代码高亮插件就需要向head标签中插入css和js引用,如果头部没有wp_head()函数,就不会自动调用,它们是依赖wp_head()函数输出的。
解决方法如下,在主题目录下的header.php文件的head标签中插入如下代码即可:
<?php wp_head(); ?>
那么wp_head()函数为何方神圣?以下为WordPress官方表述:
<?php ... /* Always have wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, and meta tags. */ wp_head(); ?> </head>
阿里云官方活动:https://t.aliyun.com/U/FzmsXA
腾讯云官方活动:https://curl.qcloud.com/oRMoSucP
