我的静态主页中没有弹出我的javascript,因为即使我已经将它正确地放在我的functions.php文件中,正斜杠也会在get_stylesheet_directory_uri()
之后消失。每当我访问我网站的另一个页面时,都会出现正斜杠,并在该页面中弹出警报。这是我的代码。
的functions.php
<?php
function custom_javascript(){
wp_enqueue_script( 'custom js', get_stylesheet_directory_uri() .'/js/custom.js' );
}
add_action( 'wp_enqueue_scripts', 'custom_javascript' );
my-static-homepage-page-source (正斜杠不存在)
<script type='text/javascript' src='http://caraga.com/template/wp-content/themes/gwt-wordpress-master-childjs/custom.js?ver=4.1'></script>
my-other-page-page-source (正斜杠存在)
<script type='text/javascript' src='http://caraga.com/template/wp-content/themes/gwt-wordpress-master-child/js/custom.js?ver=4.1'></script>