Fitclaw
我在加载css/js文件时遇到问题。他们上传到ftp上,但我必须用整个路径(包括域)指导他们,因为../它不起作用。这是针对CSS的。JS不起作用,我不知道为什么我请你查看页面源代码,我将在这里上传功能。来自引导程序主题的php。
<?php
function add_theme_scripts(){
wp_enqueue_script(\'jquery\', get_stylesheet_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/js/jquery.js\');
wp_enqueue_style( \'style\', get_stylesheet_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/style.css\' );
wp_enqueue_style( \'loader\', get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/css/loader.css\');
wp_enqueue_style( \'font-awesome.min\', get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/css/font-awesome.min.css\');
wp_enqueue_style( \'ie.min\', get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/css/ie.css\');
wp_enqueue_style( \'normalize\', get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/css/normalize.css\');
wp_enqueue_script( \'jquery.countdown.min.js\', get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/js/jquery.countdown.min.js\',array ( \'jquery\' ) );
wp_enqueue_script( \'main\', get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/js/main.js\',array ( \'jquery\' ));
wp_enqueue_script( \'plugins\', get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/js/plugins.js\',array(\' jquery \'));
}
add_action( \'wp_enqueue_scripts\', \'add_theme_scripts\' );
?>
这是函数。php和它不工作。谢谢你的帮助
SO网友:socki03
您似乎正在将两个文件/文件夹名称都加载到队列中。
get_template_directory_uri() . \'http://fitclaw.com/wp-content/themes/Coming%20Soon/js/jquery.js
应仅为:
get_template_directory_uri() . \'/js/jquery.js\'
等等等等。
因为get_template_directory_uri
返回或应为您返回此字符串:\'http://fitclaw.com/wp-content/themes/Coming%20Soon/\'
您应该始终尝试使用这些相对路径,而不是硬编码它们。