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
4558           $page_links[] = sprintf(
4559                '<a class="prev page-numbers" href="%s">%s</a>',
4560                /**
4561                 * Filters the paginated links for the given archive pages.
4562                 *
4563                 * @since 3.0.0
4564                 *
4565                 * @param string $link The paginated link URL.
4566                 */
4567                esc_url( apply_filters( 'paginate_links', $link ) ),
4568                $args['prev_text']
4569           );
4570      endif;
4571
4572      for ( $n = 1; $n <= $total; $n++ ) :
4573           if ( $n == $current ) :
4574                $page_links[] = sprintf(
4575                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4576                     esc_attr( $args['aria_current'] ),
 
Line Code
4584                     $link = str_replace( '%#%', $n, $link );
4585                     if ( $add_args ) {
4586                          $link = add_query_arg( $add_args, $link );
4587                     }
4588                     $link .= $args['add_fragment'];
4589
4590                     $page_links[] = sprintf(
4591                          '<a class="page-numbers" href="%s">%s</a>',
4592                          /** This filter is documented in wp-includes/general-template.php */
4593                          esc_url( apply_filters( 'paginate_links', $link ) ),
4594                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4595                     );
4596
4597                     $dots = true;
4598                elseif ( $dots && ! $args['show_all'] ) :
4599                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4600
4601                     $dots = false;
4602                endif;
 
Line Code
4608           $link = str_replace( '%#%', $current + 1, $link );
4609           if ( $add_args ) {
4610                $link = add_query_arg( $add_args, $link );
4611           }
4612           $link .= $args['add_fragment'];
4613
4614           $page_links[] = sprintf(
4615                '<a class="next page-numbers" href="%s">%s</a>',
4616                /** This filter is documented in wp-includes/general-template.php */
4617                esc_url( apply_filters( 'paginate_links', $link ) ),
4618                $args['next_text']
4619           );
4620      endif;
4621
4622      switch ( $args['type'] ) {
4623           case 'array':
4624                return $page_links;
4625
4626           case 'list':