Function pagination ($ QUERY_STRING ){
Global $ posts_per_page, $ paged;
$ My_query = new wp_query ($ QUERY_STRING. "& posts_per_page =-1 ");
$ Total_posts = $ my_query-> post_count;
If (empty ($ PAGED) $ paged = 1;
If ($ paged <= 1)
$ Prev = $ paged-1;
$ Next = $ paged + 1;
$ Range = 2; // only edit this if you want to show more page-links
$ Showitems = ($ range * 2) + 1;
$ Pages = Ceil ($ total_posts/$ posts_per_page );
If ($ pages <= 1) return;
If (1! = $ Pages ){
Echo '<Div class = "pagination"> ';
Echo ($ paged> 1 )? "<A href = '". get_pagenum_link (1). "'> first page </a>": "First page ";
Echo ($ paged> 1 )? "<A href = '". get_pagenum_link ($ PREV). "'> previous page </a>": "Previous Page ";
/*
For ($ I = 1; $ I <= $ pages; $ I ++ ){
If (1! = $ Pages &&(! ($ I >=$ paged + $ range + 1 | $ I <= $ paged-$ range-1) | $ pages <= $ showitems )){
Echo ($ paged = $ I )? "<SPAN class = 'current'> ". $ I. "</span>": "<a href = '". get_pagenum_link ($ I ). "'class = 'inactive'> ". $ I. "</a> ";
}
}*/
Echo ($ paged! = $ Pages )? "<A href = '". get_pagenum_link ($ next). "'> next page </a>": "Next page ";
Echo ($ paged! = $ Pages )? "<A href = '". get_pagenum_link ($ pages). "'> last page </a>": "last page ";
Echo 'total <font color = Red> <strong> '. $ total_posts. '</strong> </font> records per page <font color = Red> <strong> '. $ posts_per_page. '</strong> </font> total <font color = Red> <strong> '. $ pages. '</strong> </font> current <font color = Red> <strong> '. $ paged. '</strong> </font> page </div> ';
}
}