wp_footer
该函数与wp_header一致,主要区别在于前者应用于头部,而这个应用于底部。
该函数无实际功能,主要是埋下了一个钩子。与该钩子挂钩的函数决定了WordPress主题底部运行的代码,可以是输出HTML也可以是引入js等资源。
源码
文件:wp-includes / general-template.php 2019行
function wp_footer() {
/**
* Prints scripts or data before the closing body tag on the front end.
*
* @since 1.5.1
*/
do_action( 'wp_footer' );
}
列子
一个WordPress底部公共模板文件 footer.php 如下:
<?php wp_footer(); ?>
</body>
</html>