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