I would like to use paginate links on my archive page where I list all the posts from the website.
I would like to show only 10 posts per page and in the bottom to have OLDER POSTS link to display older posts on next page.
I tried adding pagginate function at the end but nothing shows up to me in the front end so I must be doing something wrong.
My current code looks like this:
<div class="container">
<div class="content col-md-9">
<div class="home-content">
<!-- Show posts -->
<?php $posts = get_posts(array('category'=>'', 'posts_per_page'=>10)); ?>
<?php if($posts) { ?>
<?php foreach ($posts as $post) { setup_postdata($post); ?>
<div style="float:left; margin:1%;">
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail( 'thumbnail', array( 'class' => 'img-post')); // show featured image
}
?>
</div>
<h1 class="post-thumb"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<h4>Category: <?php the_category(', '); ?></h4>
<p><?php the_excerpt(); ?></p>
<hr style="margin-bottom:5%">
<?php } wp_reset_postdata(); ?>
<?php } else { ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php } ?>
<?php if (function_exists("emm_paginate")) {
emm_paginate();
} ?>
</div>
</div>
<div class="col-md-3 sidebar unstyled">
<?php dynamic_sidebar( 'home1' ); ?>
</div>
<div class="col-md-3 sidebar unstyled sidebar-space">
<?php dynamic_sidebar( 'home2' ); ?>
</div>
<div class="col-md-3 sidebar unstyled sidebar-space">
<?php dynamic_sidebar( 'articles1' ); ?>
</div>
</div>
</div>
</body>