在页脚上加载javascript时出错(wordpress)

在页脚上加载javascript时出错(wordpress),javascript,jquery,wordpress,footer,Javascript,Jquery,Wordpress,Footer,我正试图优化我公司的网站,现在我正试图让wordpress在页脚而不是网页顶部加载所有javascript,以便更快地加载网站。 我在function.php文件中添加了以下代码: // super easy way to move javascript to footer remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_actio

我正试图优化我公司的网站,现在我正试图让wordpress在页脚而不是网页顶部加载所有javascript,以便更快地加载网站。 我在function.php文件中添加了以下代码:

// super easy way to move javascript to footer
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);
add_action('wp_footer', 'wp_print_scripts', 5);
add_action('wp_footer', 'wp_enqueue_scripts', 5);
add_action('wp_footer', 'wp_print_head_scripts', 5);    
问题是,我使用的是一个内置javascript的滑块插件,在这段代码中它消失了

有人知道我如何从我的wordpress页面的页脚加载所有javascript和jquery,并且滑块没有消失吗

网站url为www.contidosdixitais.com


非常感谢

也许下面的代码可以做到这一点:

// The callback function for the action hook bellow
function any_script_in_footer()
{
    // Call the list with all the registered scripts
    global $wp_scripts;

    if ( isset ( $wp_scripts->registered ) && ! empty ( $wp_scripts->registered ) && is_array( $wp_scripts->registered ) ) {
        foreach ( $wp_scripts->registered as $idx => $script ) {
            if ( isset( $wp_scripts->registered[ $idx ]->extra ) && is_array( $wp_scripts->registered[ $idx ]->extra ) ) {

                // Set any of the scripts to belong in the footer group
                $wp_scripts->registered[ $idx ]->extra[ 'group' ] = 1;
            }
        }
    }
}

// Call the callback function with the `wp_print_scripts` hook at the very end 
// of the callbacks cue
add_action('wp_print_scripts', 'any_script_in_footer', 1000);

您缺少一些代码。请分享你的实际功能。你也应该做
add\u action('wp\u enqueue\u scripts','function\u name')
,而不是挂接到
wp\u footer
。我不知道javascript,所以我在教程中找到了这段代码。我安装了一个“movejavascript-tofooter”插件,该插件在他的php文件中包含相同的代码,所以我决定手动添加它。主要的问题是,所有东西都在最后加载,滑块不工作。我不是说JS,我是说functions.PHP文件中的PHP。