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