Hi,
We always see in the pagination of our WordPress blog page that if we are in the first page then the previous text automatically stay hidden like the image below. This is wordpress default function,
But now I’ll show you how to Show or always Show previous text and next text in your wordpress blog page in the pagination like this.
So Guys let’s start.
When you will add the pagination like this in your blog page,
<?php the_posts_pagination( array( 'prev_text' => 'Previous page', 'next_text' =>'Next page' ) ); ?>
You will see the default function of wordpress.
Now, to customiz it according to the tutorial, keep empty and a space in all of two like this,
<?php the_posts_pagination( array( 'prev_text' => ' ', 'next_text' =>'' ) ); ?>
Then code it like below,
<?php if(!get_previous_posts_link()) { echo '« Previous Page' ; } else { previous_posts_link('« Previous Page'); } the_posts_pagination( array( 'prev_text' => ' ', 'next_text' => ' ', ) ); if(!get_next_posts_link()) { echo '« Next Page' ; } else { next_posts_link('« Next Page'); } ?>
Now your are done.
Enjoy
Stay active and Keep learning