Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: paginate_links

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
2463           $link .= $add_fragment;
2464
2465           /**
2466            * Filter the paginated links for the given archive pages.
2467            *
2468            * @since 3.0.0
2469            *
2470            * @param string $link The paginated link URL.
2471            */
2472           $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $prev_text . '</a>';
2473      endif;
2474      for ( $n = 1; $n <= $total; $n++ ) :
2475           if ( $n == $current ) :
2476                $page_links[] = "<span class='page-numbers current'>" . $before_page_number . number_format_i18n( $n ) . $after_page_number . "</span>";
2477                $dots = true;
2478           else :
2479                if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
2480                     $link = str_replace('%_%', 1 == $n ? '' : $format, $base);
2481                     $link = str_replace('%#%', $n, $link);
2482                     if ( $add_args )
2483                          $link = add_query_arg( $add_args, $link );
2484                     $link .= $add_fragment;
2485
2486                     /** This filter is documented in wp-includes/general-template.php */
2487                     $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $before_page_number . number_format_i18n( $n ) . $after_page_number . "</a>";
2488                     $dots = true;
2489                elseif ( $dots && !$show_all ) :
2490                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
2491                     $dots = false;
2492                endif;
2493           endif;
2494      endfor;
2495      if ( $prev_next && $current && ( $current < $total || -1 == $total ) ) :
2496           $link = str_replace('%_%', $format, $base);
2497           $link = str_replace('%#%', $current + 1, $link);
2498           if ( $add_args )
2499                $link = add_query_arg( $add_args, $link );
2500           $link .= $add_fragment;
2501
2502           /** This filter is documented in wp-includes/general-template.php */
2503           $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $next_text . '</a>';
2504      endif;
2505      switch ( $type ) :
2506           case 'array' :
2507                return $page_links;
2508                break;
2509           case 'list' :
2510                $r .= "<ul class='page-numbers'>\n\t<li>";
2511                $r .= join("</li>\n\t<li>", $page_links);
2512                $r .= "</li>\n</ul>\n";