When there are a few post in archive.php, fill in with last post

I would like to fill archive.php when it has 6 or less post. After the last post, add up to 20 posts.

<?php if (have_posts()) : ?>
<?php if (($wp_query->post_count) > 6) : ?>
<?php while (have_posts()) : the_post(); ?>
<a href=”<?php the_permalink(); ?>” rel=”bookmark”><?php echo get_the_title(); ?></a>
<?php endwhile; ?>
<?php else : ?>
<?php while (have_posts()) : the_post(); ?>
<a href=”<?php the_permalink(); ?>” rel=”bookmark”><?php echo get_the_title(); ?></a>
<?php endwhile; ?>
<?php endif; ?>
<?php else : ?>
<?php endif; ?>

Read more here:: When there are a few post in archive.php, fill in with last post

Leave a Reply

Your email address will not be published. Required fields are marked *