The following tells Wordpress to display all posts with category Blog,
The comment template is included at the bottom, but is not shown when the apge renders.
Any suggestions?
home.php:
<?php
/**
* Template Name: Blog
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header(); ?>
<div id="main-content">
<?php query_posts('category_name=Blog&showposts=10'); ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_front_page() ) { ?>
<h2 class="entry-title"><?php the_title(); ?></h2>
<?php } else { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } ?>
<div class="entry-cont开发者_如何学Goent">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-content -->
</div><!-- #post-## -->
<?php comments_template( '', true ); ?>
<?php endwhile; ?>
</div><!-- #main-content -->
<?php get_footer(); ?>
I think the problem is that you're trying to use comments_template();
in a looping fashion -- it's only for single posts or page templates.
See: http://codex.wordpress.org/Function_Reference/comments_template Quote: "Description -- Loads the comment template. For use in single post and Page displays."
If anybody wonders how, as seen here http://wordpress.org/support/topic/using-comments_template-outside-of-singlephp
<?php
$withcomments = 1;
comments_template(); ?>
精彩评论