Contact Us form at BluegrassMiataClub =dot= com Sample Usage: */ global $wp_query,$wp_rewrite; $numofpages = $wp_query->max_num_pages; //echo "

NUMOFPAGES:$numofpages

"; if ($numofpages > 1) { //echo '

wp_query:';print_r($wp_query);echo '

'; //echo '

permalink_structure:';print_r(get_option('permalink_structure'));echo '

'; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $currpage = $_SERVER['REQUEST_URI']; if (!$_SERVER['QUERY_STRING']) $currpage = trailingslashit($currpage); //echo "

CURRPAGE BEFORE:$currpage

"; // We want to reformat currpage so paged= is at the end of the string, // and relocate any other parameters as necessary. // Are we using pretty permalinks? $pretty = ($wp_rewrite && $wp_rewrite->using_permalinks()) ? TRUE : FALSE; if (!$pretty) { if (preg_match('/([?&])paged=\d+(\&)?/',$currpage,$matches)) { //echo "

MATCHES:";print_r($matches);echo "

"; if ($matches[1] == '?') { if ($matches[2] == '&') { // paged is first, followed by other params $currpage = preg_replace('/\?paged=\d+\&/','?',$currpage); $currpage .= '&paged='; } else { // ?paged= is alone $currpage = preg_replace('/\?paged=\d+/','',$currpage); $currpage .= '?paged='; } } else { // &paged=n is not first $currpage = preg_replace('/&paged=\d+/','',$currpage); $currpage .= '&paged='; } } else { // There is no paged=n parameter // If query_string exists, use &paged=, else use ?paged= . if ($_SERVER['QUERY_STRING']) { $currpage .= '&paged='; } else { $currpage .= '?paged='; } } } else { // Using pretty permalinks // If there is no /page/n/, add page/1/ to $currpage. if (!preg_match('#/page/\d+#',$currpage)){ if (strpos($currpage,'/?')) { $currpage = preg_replace('#/\?#','/page/1/?',$currpage); } else { $currpage .= 'page/1/'; } } } //echo "

CURRPAGE AFTER:$currpage

"; $pagelinks = "$jumptext