我有一个页面,我想要为worpress中的特定页面加载一个sytlesheet和一个JS文件。页面不在Wordpress中加载样式表或JS文件
我在tabContent.css位于名为tabcontent - >模板的目录的head部分中添加了以下代码,该模板与我的functions.php文件位于同一目录中,并且类似于js文件。
<link href="<?php echo bloginfo('stylesheet_directory');?>/tab-content/template1/tabcontent.css" rel="stylesheet" type="text/css" />
<script src="<?php echo bloginfo('stylesheet_directory');?>/tab-content/tabcontent.js" type="text/javascript"></script>
我怎样才能正确地加载这些文件。
感谢
我有点困惑。因此,如果您的主题文件夹是xyz,则位于“xyz/tabcontent.css”,“xyz/tab-content/tabcontent.css”,“xyz/tab-content/template1/tabcontent.css”中的'tabcontent.css'或“xyz/tab-content/template/tabcontent.css”? –
@TomaszNguyen抱歉应该更清楚。它是xyz/tab-content/template1/tabcontent.css其中xyz是我的主题文件夹 – user2798091
看来您使用的代码很好。你可以看看http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri。 –