I'm a beginner developer so I'm sorry if I've made some obvious mistake, but I simply don't get why my loop for posts is not displaying all of my posts, I created 14 test posts and set the Reading options in Wordpress to display latest posts and put the number to 10, however, only 5 posts appear on the first page and when I click on 2nd page in the pagination there's only 1 post and my footer goes all the way up to the end of the post box instead of staying down on the 2nd page.
<?php get_header(); ?>
<div class='containter containter--narrow page-section'>
<?php if ( have_posts() ) :
while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" class='post-item'>
<h2><a class="post-title headline headline-medium" href='<?php the_permalink(); ?>'><?php the_title(); ?></a></h2>
<hr>
<div class='metabox'>Author: <?php the_author_posts_link(); ?> Published on: <?php the_time('d/M/Y'); ?> Categories: <?php echo get_the_category_list(', '); ?></div>
<div class="post-excerpt content">
<?php the_excerpt() ?>
<p><a class='read-more' href="<?php echo get_permalink(the_post()); ?>">Read More »</a></p>
</div>
</article>
<?php endwhile;
endif;
echo paginate_links(); ?>
</div>
<?php get_footer();
?>
query_posts
which is a terrible function you should never use. Avoid it like the plague.query_posts
anywhere in your code? Never use that function, it will break your pagination and double the number of queries on your page. As for your code, under normal circumstances this should work as is, but plugins and filters can interfere. I also don't understand the reference to your footer, there is no footer code in your question, and I don't see how it impacts the pagination