When we are developing the new wordpress theme then we need to always need to think about post pagination and in post pagination. Yes, there is difference between post pagination and in post pagination.
If you want to keep single post and pagination between in single post that is also possiable through wordpress api. In this article I will show you hwo to use the in page or post pagination.
Open your single.php file from wordpress theme folder and put following code in that.
<?php wp_link_pages( ); ?>
We can pass the following parameter the this function.
<?php $args = array(
'before' => '<p>' . __('Pages:'),
'after' => '</p>',
'link_before' => ,
'link_after' => ,
'next_or_number' => 'number',
'nextpagelink' => __('Next page'),
'previouspagelink' => __('Previous page'),
'pagelink' => '%',
'more_file' => ,
'echo' => 1 ); ?>
<?php wp_link_pages( $args ); ?>
This is the one of the sample code.
<?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink=page %'); ?>
Now I will explain What wordpress doing for using this function. WordPress is using simple explode php function for using the next page tag. Like following way.
$content = get_the_content();
$pages = explode('<!--nextpage-->', $content);
you can also use the above code in your loop.





Interesting read, perhaps the best article iv’e browse today. We learn everyday cheers to you!
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
Thanks for posting. Good to see that not everyone is using RSS feeds to build their blogs
Awesome post. I so good to see someone taking the time to share this information
Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
This post makes a lot of sense !
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader
Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader
Hello, this is my first time i visit here. I found so many interesting in your blog especially on how to determine the topic. keep up the good work.
I REALLY liked your post and blog! It took me a minute bit to find your site…but I bookmarked it. Would you mind if I posted a link back to your post?
I would like to say “wow” what a inspiring post. This is really great. Keep doing what you’re doing!!
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Nice post! You truly have a wonderful way of writing which I find captivating! I will definitely be bookmarking you and returning to your blog. In fact, your post reminded me about a strange thing that happened to me the other day. I’ll tell you about that later…
I’ve just started off a blog, the knowledge you give on this site has aided me extremely. Thank you for all your time & work.