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
4281           $page_links[] = sprintf(
4282                '<a class="prev page-numbers" href="%s">%s</a>',
4283                /**
4284                 * Filters the paginated links for the given archive pages.
4285                 *
4286                 * @since 3.0.0
4287                 *
4288                 * @param string $link The paginated link URL.
4289                 */
4290                esc_url( apply_filters( 'paginate_links', $link ) ),
4291                $args['prev_text']
4292           );
4293      endif;
4294
4295      for ( $n = 1; $n <= $total; $n++ ) :
4296           if ( $n == $current ) :
4297                $page_links[] = sprintf(
4298                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4299                     esc_attr( $args['aria_current'] ),
 
Line Code
4307                     $link = str_replace( '%#%', $n, $link );
4308                     if ( $add_args ) {
4309                          $link = add_query_arg( $add_args, $link );
4310                     }
4311                     $link .= $args['add_fragment'];
4312
4313                     $page_links[] = sprintf(
4314                          '<a class="page-numbers" href="%s">%s</a>',
4315                          /** This filter is documented in wp-includes/general-template.php */
4316                          esc_url( apply_filters( 'paginate_links', $link ) ),
4317                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4318                     );
4319
4320                     $dots = true;
4321                elseif ( $dots && ! $args['show_all'] ) :
4322                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4323
4324                     $dots = false;
4325                endif;
 
Line Code
4331           $link = str_replace( '%#%', $current + 1, $link );
4332           if ( $add_args ) {
4333                $link = add_query_arg( $add_args, $link );
4334           }
4335           $link .= $args['add_fragment'];
4336
4337           $page_links[] = sprintf(
4338                '<a class="next page-numbers" href="%s">%s</a>',
4339                /** This filter is documented in wp-includes/general-template.php */
4340                esc_url( apply_filters( 'paginate_links', $link ) ),
4341                $args['next_text']
4342           );
4343      endif;
4344
4345      switch ( $args['type'] ) {
4346           case 'array':
4347                return $page_links;
4348
4349           case 'list':