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
4572           $page_links[] = sprintf(
4573                '<a class="prev page-numbers" href="%s">%s</a>',
4574                /**
4575                 * Filters the paginated links for the given archive pages.
4576                 *
4577                 * @since 3.0.0
4578                 *
4579                 * @param string $link The paginated link URL.
4580                 */
4581                esc_url( apply_filters( 'paginate_links', $link ) ),
4582                $args['prev_text']
4583           );
4584      endif;
4585
4586      for ( $n = 1; $n <= $total; $n++ ) :
4587           if ( $n == $current ) :
4588                $page_links[] = sprintf(
4589                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4590                     esc_attr( $args['aria_current'] ),
 
Line Code
4598                     $link = str_replace( '%#%', $n, $link );
4599                     if ( $add_args ) {
4600                          $link = add_query_arg( $add_args, $link );
4601                     }
4602                     $link .= $args['add_fragment'];
4603
4604                     $page_links[] = sprintf(
4605                          '<a class="page-numbers" href="%s">%s</a>',
4606                          /** This filter is documented in wp-includes/general-template.php */
4607                          esc_url( apply_filters( 'paginate_links', $link ) ),
4608                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4609                     );
4610
4611                     $dots = true;
4612                elseif ( $dots && ! $args['show_all'] ) :
4613                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4614
4615                     $dots = false;
4616                endif;
 
Line Code
4622           $link = str_replace( '%#%', $current + 1, $link );
4623           if ( $add_args ) {
4624                $link = add_query_arg( $add_args, $link );
4625           }
4626           $link .= $args['add_fragment'];
4627
4628           $page_links[] = sprintf(
4629                '<a class="next page-numbers" href="%s">%s</a>',
4630                /** This filter is documented in wp-includes/general-template.php */
4631                esc_url( apply_filters( 'paginate_links', $link ) ),
4632                $args['next_text']
4633           );
4634      endif;
4635
4636      switch ( $args['type'] ) {
4637           case 'array':
4638                return $page_links;
4639
4640           case 'list':