在WordPress上把调用脚本从页眉转移到页脚
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在WordPress上把调用脚本从页眉转移到页脚相关的知识,希望对你有一定的参考价值。
If you have been able to check your site by means of the PageSpeed ??Insights service, you may notice that it is not an easy task to recruit even 80% of the test results. Only by completing most of the recommendations of Google, you can hope for an increase in performance.And if the compression of CSS styles and JS scripts is quite capable of any webmaster, then here’s the point “Remove the javascript and CSS code that blocks the display of the top of the page” - there are problems. First of all, due to the fact that in WordPress, many scripts are called from “wp_head”, starting from the jquery library and ending with the components of installed plugins.
RU ? EN
function footer_enqueue_scripts() { # Udaliaem JavaScript iz zagolovka remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'wp_enqueue_scripts', 1); # Vyvodim v footer 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); } add_action('after_setup_theme', 'footer_enqueue_scripts');
以上是关于在WordPress上把调用脚本从页眉转移到页脚的主要内容,如果未能解决你的问题,请参考以下文章
带有侧导航和内容区域的 CSS3/HTML5 粘性页眉/页脚