'; } } add_action('wp_head', 'wp_page_numbers_stylesheet'); function wp_page_numbers_check_num($num) { return ($num%2) ? true : false; } function wp_page_numbers_page_of_page($max_page, $paged, $page_of_page_text, $page_of_of) { $pagingString = ""; if ( $max_page > 1) { $pagingString .= '
  • '; if($page_of_page_text == "") $pagingString .= 'Page '; else $pagingString .= $page_of_page_text . ' '; if ( $paged != "" ) $pagingString .= $paged; else $pagingString .= 1; if($page_of_of == "") $pagingString .= ' of '; else $pagingString .= ' ' . $page_of_of . ' '; $pagingString .= floor($max_page).'
  • '; } return $pagingString; } function wp_page_numbers_prevpage($paged, $max_page, $prevpage) { if( $max_page > 1 && $paged > 1 ) $pagingString = '
  • '.$prevpage.'
  • '; return $pagingString; } function wp_page_numbers_left_side($max_page, $limit_pages, $paged, $pagingString) { $pagingString = ""; $page_check_max = false; $page_check_min = false; if($max_page > 1) { for($i=1; $i<($max_page+1); $i++) { if( $i <= $limit_pages ) { if ($paged == $i || ($paged == "" && $i == 1)) $pagingString .= '
  • '.$i.'
  • '."\n"; else $pagingString .= '
  • '.$i.'
  • '."\n"; if ($i == 1) $page_check_min = true; if ($max_page == $i) $page_check_max = true; } } return array($pagingString, $page_check_max, $page_check_min); } } function wp_page_numbers_middle_side($max_page, $paged, $limit_pages_left, $limit_pages_right) { $pagingString = ""; $page_check_max = false; $page_check_min = false; for($i=1; $i<($max_page+1); $i++) { if($paged-$i <= $limit_pages_left && $paged+$limit_pages_right >= $i) { if ($paged == $i) $pagingString .= '
  • '.$i.'
  • '."\n"; else $pagingString .= '
  • '.$i.'
  • '."\n"; if ($i == 1) $page_check_min = true; if ($max_page == $i) $page_check_max = true; } } return array($pagingString, $page_check_max, $page_check_min); } function wp_page_numbers_right_side($max_page, $limit_pages, $paged, $pagingString) { $pagingString = ""; $page_check_max = false; $page_check_min = false; for($i=1; $i<($max_page+1); $i++) { if( ($max_page + 1 - $i) <= $limit_pages ) { if ($paged == $i) $pagingString .= '
  • '.$i.'
  • '."\n"; else $pagingString .= '
  • '.$i.'
  • '."\n"; if ($i == 1) $page_check_min = true; } if ($max_page == $i) $page_check_max = true; } return array($pagingString, $page_check_max, $page_check_min); } function wp_page_numbers_nextpage($paged, $max_page, $nextpage) { if( $paged != "" && $paged < $max_page) $pagingString = '
  • '.$nextpage.'
  • '."\n"; return $pagingString; } function wp_page_numbers($start = "", $end = "") { global $wp_query; global $max_page; global $paged; if ( !$max_page ) { $max_page = $wp_query->max_num_pages; } if ( !$paged ) { $paged = 1; } $settings = get_option('wp_page_numbers_array'); $page_of_page = $settings["page_of_page"]; $page_of_page_text = $settings["page_of_page_text"]; $page_of_of = $settings["page_of_of"]; $next_prev_text = $settings["next_prev_text"]; $show_start_end_numbers = $settings["show_start_end_numbers"]; $show_page_numbers = $settings["show_page_numbers"]; $limit_pages = $settings["limit_pages"]; $nextpage = $settings["nextpage"]; $prevpage = $settings["prevpage"]; $startspace = $settings["startspace"]; $endspace = $settings["endspace"]; if( $nextpage == "" ) { $nextpage = ">"; } if( $prevpage == "" ) { $prevpage = "<"; } if( $startspace == "" ) { $startspace = "..."; } if( $endspace == "" ) { $endspace = "..."; } if($limit_pages == "") { $limit_pages = "10"; } elseif ( $limit_pages == "0" ) { $limit_pages = $max_page; } if(wp_page_numbers_check_num($limit_pages) == true) { $limit_pages_left = ($limit_pages-1)/2; $limit_pages_right = ($limit_pages-1)/2; } else { $limit_pages_left = $limit_pages/2; $limit_pages_right = ($limit_pages/2)-1; } if( $max_page <= $limit_pages ) { $limit_pages = $max_page; } $pagingString = "
    \n"; $pagingString .= '\n"; $pagingString .= "
    \n"; $pagingString .= "
    \n"; if($max_page > 1) echo $start . $pagingString . $end; } function wp_page_numbers_settings() { if(isset($_POST['submitted'])) { if($_POST["head_stylesheetsheet"] == "") $_POST["head_stylesheetsheet"] = "no"; if($_POST["page_of_page"] == "") $_POST["page_of_page"] = "no"; if($_POST["next_prev_text"] == "") $_POST["next_prev_text"] = "no"; if($_POST["show_start_end_numbers"] == "") $_POST["show_start_end_numbers"] = "no"; if($_POST["show_page_numbers"] == "") $_POST["show_page_numbers"] = "no"; if($_POST["style_theme"] == "") $_POST["style_theme"] = "default"; $settings = array ( "head_stylesheetsheet" => $_POST["head_stylesheetsheet"], "head_stylesheetsheet_folder_name" => $_POST["head_stylesheetsheet_folder_name"], "page_of_page" => $_POST["page_of_page"], "page_of_page_text" => $_POST["page_of_page_text"], "page_of_of" => $_POST["page_of_of"], "next_prev_text" => $_POST["next_prev_text"], "show_start_end_numbers" => $_POST["show_start_end_numbers"], "show_page_numbers" => $_POST["show_page_numbers"], "limit_pages" => $_POST["limit_pages"], "nextpage" => $_POST["nextpage"], "prevpage" => $_POST["prevpage"], "startspace" => $_POST["startspace"], "endspace" => $_POST["endspace"], "style_theme" => $_POST["style_theme"], ); update_option('wp_page_numbers_array', $settings); echo "

    WP Page Numbers plugin options updated.

    "; } $settings = get_option('wp_page_numbers_array'); $style_theme = $settings["style_theme"]; $head_stylesheet = $settings["head_stylesheetsheet"]; $head_stylesheet_folder_name = $settings["head_stylesheetsheet_folder_name"]; $page_of_page = $settings["page_of_page"]; $page_of_page_text = $settings["page_of_page_text"]; $page_of_of = $settings["page_of_of"]; $next_prev_text = $settings["next_prev_text"]; $show_start_end_numbers = $settings["show_start_end_numbers"]; $show_page_numbers = $settings["show_page_numbers"]; $limit_pages = $settings["limit_pages"]; $nextpage = $settings["nextpage"]; $prevpage = $settings["prevpage"]; $startspace = $settings["startspace"]; $endspace = $settings["endspace"]; ?>

    Page Number Themes

    Use themes? /> Include theme stylesheet for page numbers
    Modern />
    Classic />
    Tiny />
    Panther />
    Stylish />
    Theme folder name: OVERRIDE settings above
    - Have you create a cool WP Page Numbers theme?
    - Want to share it to the rest of the world? Write a comment about it.

    Settings - Text

    Default text: Page
    Default text: of
    Default text: <
    Default text: ...
    Default text: ...
    Default text: >

    Settings - show / hide

    Show page info /> Page 3 of 5
    Show next / previous page text /> < >
    Show start and end numbers /> 1... ...5
    Show page numbers /> 34567

    Settings - Misc

    Number of pages to show: 10 (0 = unlimited)

    Instructions - Code to add to your theme

    Add the code where you find previous_post() and next_post() functions. If you can't find these tags, place the code between endwhile; and endif; in the_loop.

    Code to add in your theme
    <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>

    Advanced (optional) settings

    Syntax: wp_page_numbers($start, $end); Example: wp_page_numbers("<div class='start'>", "</div>");

    Instructions - Settings

    Most of the settings are already set to a default value if blank.

    Text options
    You can set all the texts to what ever you like, except the numbers. They will still be numbers.

    Number of pages to show
    This will limit your paging menu. Set a of maximum amount of pages to be displayed at the same time. If the textfield is blank, 10 is set by default. If 0 is set, it will not limit the paging.

    Theme folder name
    1. Copy one of the theme folders
    2. Edit the 'wp-page-numbers.css' to make your changes
    3. Rename your folder copy to a theme name
    4. Upload your folder into 'wp-content/plugins/wp-page-numbers/'
    5. Set your 'Theme folder name' in admin 'Settings / WP Page Numbers'
    6. 'Update settings'. Done!