这对我来说很有用。看看它是否适合你。以下是逐步说明:
步骤-1
在主题的循环单曲中。php,看看这个:
<?php comments_template( \'\', true ); ?>
将其替换为:
<?php global $withcomments; $withcomments = 1; comments_template( \'\', true ); ?>
步骤-2
创建首页。包含以下内容的php:
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other \'pages\' on your WordPress site will use a
* different template.
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-index.php and that will be used instead.
*/
get_template_part( \'loop-single\' );
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>