修改index.php
<?php get_header(); ?>
<div class="page-information-card-container"></div>
<?php get_sidebar(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main article-list article-list-home" role="main">
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
if (get_post_type() == 'shuoshuo'){
get_template_part( 'template-parts/content-shuoshuo-preview' );
}else{
get_template_part( 'template-parts/content-preview', get_option('argon_article_list_layout', '1'));
}
endwhile;
?>
<?php
echo get_argon_formatted_paginate_links_for_all_platforms();
?>
<?php
endif;
?>
<?php get_footer(); ?>
<?php get_header(); ?>
<div class="page-information-card-container"></div>
<?php get_sidebar(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main article-list article-list-home" role="main">
<?php
// 定义查询参数,获取所有文章
$args = array(
'posts_per_page' => -1, // -1 表示获取所有文章
'post_type' => 'post',
'post_status' => 'publish'
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) :
$query->the_post();
if (get_post_type() == 'shuoshuo'){
get_template_part( 'template-parts/content-shuoshuo-preview' );
}else{
get_template_part( 'template-parts/content-preview', get_option('argon_article_list_layout', '1'));
}
endwhile;
wp_reset_postdata(); // 重置文章查询
endif;
?>
</main>
</div>
<?php get_footer(); ?>