$paginateAfterNposts) && $_GET['offset'] != "all" ) { //get total number of pages needed $num_of_pages = ceil(count($posts)/$paginateAfterNposts); //print out navigation $paginationNavigation .= "Page: "; //If the user requested a navigation, then figure out what pages to make links for. if ($briefnavigation) { $lowtest = $offset +1 - $navpad; $hightest = $offset + 1 + $navpad; } for ($i = 0; $i < $num_of_pages; $i++) { $pg = $i + 1; //Make the navigation //Make a link for page 1 and the last page, and for pages offset-$navpad to offset+$navpad //Also make all page links if $briefnavigation == false if ((!$briefnavigation) || (($pg == 1) || ($pg == $num_of_pages) || (($pg > $lowtest) && ($pg < $hightest)))) { if ($i != 0) { $paginationNavigation .= $pageNavDivider; } //are we on the current page? if ($offset != $i) { if(strrpos($_SERVER['REQUEST_URI'],'&offset=') !== false) { $newurl = preg_replace('/(\&offset=)(\d+)(&|)/i', '', $_SERVER['REQUEST_URI']); $addchar = "&"; } else if (strrpos($_SERVER['REQUEST_URI'],'?offset=') !== false) { $newurl = preg_replace('/(\?offset=)(\d+)(&|)/i', '', $_SERVER['REQUEST_URI']); if (strrpos($newurl,'?') !== false) { $addchar = "&"; } else { $addchar = "?"; } } else { $newurl = $_SERVER['REQUEST_URI']; $addchar = "?"; } $paginationNavigation .= "$pg"; } else { $paginationNavigation .= $pg; } } else { //Add the divider. If the string ends in an ellipsis ('...') then do nothing if (!preg_match ("/\.\.\.\$/", $paginationNavigation)) { $paginationNavigation .= "$pageNavDivider..."; } } } } // end creating navigation $cutafterPostNum = $offset * $paginateAfterNposts; $posts = array_slice($posts, $cutafterPostNum, $paginateAfterNposts); } // end if paginate the page at all } //end wp-paginate() function function print_pg_navigation ($before = '', $after = '') { global $paginationNavigation; if ($paginationNavigation != '') { echo $before.$paginationNavigation.$after; } } ?>