wordpress pagination in page.php or display subpages as paging under parent page

How to add WordPress Pagination in page.php ?

Some time before i have faced a problem to adding pagination with in page.php of wordpress, even there are very good and easy option to add paging in post pages or blog pages by just adding

 <span class=”fl continue-archives-alt”><?php next_posts_link(‘Older Entries’) ?></span>    
 <span class=”fr continue-archives”><?php previous_posts_link(‘Newer Entries’) ?></span>

but i did not find any way “how to add paging on page.php”, as my client required, a page with next back facility on it, so i have research and find out a way to add paging with in page.php

its simple one but it not run automatically, so you can set any number of records, but it will works manually but works well.

what you need to do ?

just copy these steps and it will work for you too.

for run paging you need to add more (next ) page as sub pages or child page of main page.

like

contentpage — parent page
     content page 1 — child page
    content page 2  — child page

above setting can be done by admin panel by “manage pages”

now what we need to add in page.php

<?php
### paging of subpages
  if($post->post_parent)
  $children = wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&echo=0″);
  else
  $children = wp_list_pages(“title_li=&child_of=”.$post->ID.”&echo=0″);
  if ($children) { ?>

Add above line under your “while “

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>  
your contents …. etc.

ADD HERE

<?php } ?>

This will create your links, which can customized by css classes

<li class=”subpagenav”>
<ul>
<li>Pages :</li>
<?php if($post->post_parent!=0) { ?>
<li><?php echo wp_list_pages(“title_li=&include=”.$post->post_parent.”&echo=0″); ?></li>
<?php } ?>
  <?php echo $children; ?>
  </ul>
  </li>
  <?php } ?>

please try this, i guess it will work well to you

enjoy