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