我正在制作一个新模板,我需要将注释模板放置在wordpress循环之外,并且正好位于单页页脚上方。php文件。
我在谷歌上搜索过,我能找到的与我的问题相关的最佳答案是以下链接:https://stackoverflow.com/questions/6384205/displaying-the-wordpress-comments-template-outside-the-loop
然而,这并不奏效。所有帖子上都出现了相同的评论。
那么,如何在wp循环外显示注释?
编辑:这是单曲。php文件
<?php
get_header(); ?>
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( \'content-single\', get_post_format() ); ?>
<nav class="nav-single">
<h3 class="assistive-text"><?php _e( \'Post navigation\', \'twentytwelve\' ); ?></h3>
<span class="nav-previous"><?php previous_post_link( \'%link\', \'<span class="meta-nav">\' . _x( \'←\', \'Previous post link\', \'twentytwelve\' ) . \'</span> %title\' ); ?></span>
<span class="nav-next"><?php next_post_link( \'%link\', \'%title <span class="meta-nav">\' . _x( \'→\', \'Next post link\', \'twentytwelve\' ) . \'</span>\' ); ?></span>
</nav><!-- .nav-single -->
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<div id="secondary" class="sidebar-area" role="complementary">
<?php get_sidebar(secondary); ?>
<?php get_sidebar(); ?>
</div><!-- #secondary -->
<?php
comments_template( \'\', true );
?>
<?php get_footer(); ?>