<?php if ( have_posts() ) : ?><!-- .page-header -->
<div class="clearfix enclose">
<?php
// Start the Loop.
while ( have_posts() ) : the_post(); ?>
<div class="sub-category-block">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(\'medium_thumbnail\'); ?>
<p class="title"><?php the_title(); ?></p>
</a>
</div>
<?php endwhile; ?>
</div>
<?php else : ?>
<div class="page-header">
<?php $args = array(
\'posts_per_page\' => 5,
\'offset\' => 0,
\'category\' => \'\',
\'category_name\' => \'\',
\'orderby\' => \'date\',
\'order\' => \'DESC\',
\'include\' => \'\',
\'exclude\' => \'\',
\'meta_key\' => \'\',
\'meta_value\' => \'\',
\'post_type\' => \'post\',
\'post_mime_type\' => \'\',
\'post_parent\' => \'\',
\'author\' => \'\',
\'post_status\' => \'publish\',
\'suppress_filters\' => true
);?>
<?php query_posts( $args ); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php endwhile; wp_reset_query(); ?>
</div><!-- .page-header -->
<?php endif; ?>
创建类别模板文件,例如类别abc。php并插入上述代码,您将获得重复父类别的所有子类别,当您单击子类别时,将显示子类别的帖子