为什么在wp_footer()footer.php本身中调用wp_footer()?
问题描述:
我想了解WP中创建的主题。根据我的理解,wp_footer()在主页面包含footer.php。但我不明白的是为什么wp_footer()在footer.php中被调用,就像在二十七页脚中一样?为什么在wp_footer()footer.php本身中调用wp_footer()?
</div><!-- #content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="wrap">
<?php
get_template_part('template-parts/footer/footer', 'widgets');
if (has_nav_menu('social')) : ?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e('Footer Social Links Menu', 'twentyseventeen'); ?>">
<?php
wp_nav_menu(array(
'theme_location' => 'social',
'menu_class' => 'social-links-menu',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>' . twentyseventeen_get_svg(array('icon' => 'chain')),
));
?>
</nav><!-- .social-navigation -->
<?php endif;
get_template_part('template-parts/footer/site', 'info');
?>
</div><!-- .wrap -->
</footer><!-- #colophon -->
</div><!-- .site-content-contain -->
</div><!-- #page -->
<?php wp_footer(); Here?>
答
wp_footer()在不用于包含页脚的wordpress中,实际上get_footer()是这样做的。
wp_footer()用于输出数据或在关闭body标签之前执行后台操作。
希望能够说清楚!
答
据我所知,footer.php中的wp_footer()用于在前端关闭正文标签之前打印脚本或数据。
参考链接:http://www.twoclock.com/wp_footer-wordpress-action-hook/