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
4589           $page_links[] = sprintf(
4590                '<a class="prev page-numbers" href="%s">%s</a>',
4591                /**
4592                 * Filters the paginated links for the given archive pages.
4593                 *
4594                 * @since 3.0.0
4595                 *
4596                 * @param string $link The paginated link URL.
4597                 */
4598                esc_url( apply_filters( 'paginate_links', $link ) ),
4599                $args['prev_text']
4600           );
4601      endif;
4602
4603      for ( $n = 1; $n <= $total; $n++ ) :
4604           if ( $n == $current ) :
4605                $page_links[] = sprintf(
4606                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4607                     esc_attr( $args['aria_current'] ),
 
Line Code
4615                     $link = str_replace( '%#%', $n, $link );
4616                     if ( $add_args ) {
4617                          $link = add_query_arg( $add_args, $link );
4618                     }
4619                     $link .= $args['add_fragment'];
4620
4621                     $page_links[] = sprintf(
4622                          '<a class="page-numbers" href="%s">%s</a>',
4623                          /** This filter is documented in wp-includes/general-template.php */
4624                          esc_url( apply_filters( 'paginate_links', $link ) ),
4625                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4626                     );
4627
4628                     $dots = true;
4629                elseif ( $dots && ! $args['show_all'] ) :
4630                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4631
4632                     $dots = false;
4633                endif;
 
Line Code
4639           $link = str_replace( '%#%', $current + 1, $link );
4640           if ( $add_args ) {
4641                $link = add_query_arg( $add_args, $link );
4642           }
4643           $link .= $args['add_fragment'];
4644
4645           $page_links[] = sprintf(
4646                '<a class="next page-numbers" href="%s">%s</a>',
4647                /** This filter is documented in wp-includes/general-template.php */
4648                esc_url( apply_filters( 'paginate_links', $link ) ),
4649                $args['next_text']
4650           );
4651      endif;
4652
4653      switch ( $args['type'] ) {
4654           case 'array':
4655                return $page_links;
4656
4657           case 'list':