0
我已經安裝在我的網站上W3的總緩存插件錯誤,並出現了最近這個錯誤:wp_footer();所謂的身體之前,但W3的總緩存顯示
您的活動主題:
·有呼叫,但它不是直接調用的結束標記
之前,這是我的footer.php歸檔的結尾:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script') [0]; s.parentNode.insertBefore(ga, s);})();
</script>
<?php wp_footer(); ?>
</body>
</html>
正如你所看到的wp_footer();
緊挨着</body>
標籤之前。我錯過了什麼嗎?
謝謝你的幫助。
您不應該直接在WordPress中調用'
你不應該直接在WordPress中調用
<script>
標籤。相反,使用wp_enqueue_script()
:google-analytics.js
然後,在你的主題
functions.php
文件或插件文件:那麼你的谷歌Analytics(分析)腳本將加載您網站的頁腳的一部分。
來源
2013-11-28 22:41:12