How to Create Simple Post Pagination In WordPress

How to Create Simple Post Pagination In WordPress

In this tutorial we are showing hot to create simple WordPress post pagination “Next Page” and “previous page” that type of pagination by default come with WordPress just you have need call functions.
Below we are showing a example of create simple pagination

WordPress Pagination PHP Code

<?php if ( have_posts() ) : ?>
    <?php  while ( have_posts() ) : the_post(); ?>
    <div class="col-md-12" style="padding-top:30px;">
        <h1 class="BlogTitle"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h1>
        <?php the_excerpt(); ?>
    </div>
    <?php endwhile; ?>
    <div class="col-md-12" style="padding-top:30px;">
        <div class="next">
            <?php echo get_previous_posts_link(); ?>
            <?php echo get_next_posts_link(); ?>
        </div>
    </div>
<?php endif; ?>

If you want to make something stylish to your pagination buttons then try below CSS Code:

.next{float:left; width:100%;}
.next a{
padding: 10px 40px;
background: #777777;
color: #b1d398;
font-size: 20px;
border-radius: 20px;
margin-right: 20px;
}
About Author

My name is Mukesh Jakhar and I am a Web Application Developer and Software Developer, currently living in Jaipur, India. I have a Master of Computer Application in Computer Science from JNU Jaipur University. I loves to write on technology and programming topics. Apart from this, I love to travel and enjoy the beauty of nature.

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.