我去解决这个问题。我取了变量名,比如$wp\\U query=new wp\\U query($arr);instate of$the\\u query=新的WP\\u query($arr);所以我的工作代码应该是
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
// global $wp_query;
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$arr = array(
\'post_type\' => \'post\',
\'posts_per_page\' => 3,
\'paged\' => $paged
);
$wp_query = new WP_Query($arr);
?>
<?php if ( $wp_query->have_posts() ) : ?>
<?php if ( is_home() && ! is_front_page() ) : ?>
<header>
<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
</header>
<?php endif; ?>
<?php
// Start the loop.
while ( $wp_query->have_posts() ) : $wp_query->the_post();
get_template_part( \'content\', get_post_format() );
// End the loop.
endwhile; ?>
<div class="nav-previous alignleft"><?php next_posts_link(\'Older Post\'); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( \'Newer posts\' ); ?></div>
<?php
wp_reset_postdata();
endif;
?>
</main><!-- .site-main -->
</div><!-- .content-area -->