0
我试图在我的Wordpress网站上使用名为show_post.js的脚本。我已经成功地直接加载它的header.php:使用wp_enqueue_script时无法加载脚本
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script type="text/javascript" src="wp-content/themes/tutorial_theme/scripts/show_post.js"></script>
然而,当我试图通过的functions.php和wp_enqueue_script它不会工作去做。这里是我的functions.php文件:
<?php function wpdocs_scripts_method() {
wp_enqueue_script('show_p', '/wp-content/themes/tutorial_theme/scripts/show_post.js', array('jquery'));
}
add_action('wp_enqueue_scripts', 'wpdocs_scripts_method');
?>
我在做什么错在这里?
有你在header.php文件前加入wp_head()函数和其主题是你的工作子主题或母题? – vrajesh