我想移动jquery。js从页眉到页脚。我尝试了以下代码:
//Remove jQuery Default function replace_jquery() { if (!is_admin()) { wp_deregister_script('jquery'); } } add_action('init', 'replace_jquery'); //Load on Footer add_action('wp_footer', 'jquery_code'); function jquery_code(){ ?> <script type='text/javascript' src='https://example.com/wp-includes/js/jquery/jquery.js'></script> <?php };问题是,如果我运行上面的第一段代码,我的主题的js文件将被jquery删除。js。因为theme的静态js文件通过
array( \'jquery\' )
属性。我只想将jquery仅从页眉移动到页脚。
NOTE: 我尝试了Stackexchange上的其他建议,但没有一个在我的博客上不起作用。(此类美国:Enqueue core jQuery in the footer?)
我该怎么做?