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
4301           $page_links[] = sprintf(
4302                '<a class="prev page-numbers" href="%s">%s</a>',
4303                /**
4304                 * Filters the paginated links for the given archive pages.
4305                 *
4306                 * @since 3.0.0
4307                 *
4308                 * @param string $link The paginated link URL.
4309                 */
4310                esc_url( apply_filters( 'paginate_links', $link ) ),
4311                $args['prev_text']
4312           );
4313      endif;
4314
4315      for ( $n = 1; $n <= $total; $n++ ) :
4316           if ( $n == $current ) :
4317                $page_links[] = sprintf(
4318                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4319                     esc_attr( $args['aria_current'] ),
 
Line Code
4327                     $link = str_replace( '%#%', $n, $link );
4328                     if ( $add_args ) {
4329                          $link = add_query_arg( $add_args, $link );
4330                     }
4331                     $link .= $args['add_fragment'];
4332
4333                     $page_links[] = sprintf(
4334                          '<a class="page-numbers" href="%s">%s</a>',
4335                          /** This filter is documented in wp-includes/general-template.php */
4336                          esc_url( apply_filters( 'paginate_links', $link ) ),
4337                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4338                     );
4339
4340                     $dots = true;
4341                elseif ( $dots && ! $args['show_all'] ) :
4342                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4343
4344                     $dots = false;
4345                endif;
 
Line Code
4351           $link = str_replace( '%#%', $current + 1, $link );
4352           if ( $add_args ) {
4353                $link = add_query_arg( $add_args, $link );
4354           }
4355           $link .= $args['add_fragment'];
4356
4357           $page_links[] = sprintf(
4358                '<a class="next page-numbers" href="%s">%s</a>',
4359                /** This filter is documented in wp-includes/general-template.php */
4360                esc_url( apply_filters( 'paginate_links', $link ) ),
4361                $args['next_text']
4362           );
4363      endif;
4364
4365      switch ( $args['type'] ) {
4366           case 'array':
4367                return $page_links;
4368
4369           case 'list':