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