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
4292           $page_links[] = sprintf(
4293                '<a class="prev page-numbers" href="%s">%s</a>',
4294                /**
4295                 * Filters the paginated links for the given archive pages.
4296                 *
4297                 * @since 3.0.0
4298                 *
4299                 * @param string $link The paginated link URL.
4300                 */
4301                esc_url( apply_filters( 'paginate_links', $link ) ),
4302                $args['prev_text']
4303           );
4304      endif;
4305
4306      for ( $n = 1; $n <= $total; $n++ ) :
4307           if ( $n == $current ) :
4308                $page_links[] = sprintf(
4309                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4310                     esc_attr( $args['aria_current'] ),
 
Line Code
4318                     $link = str_replace( '%#%', $n, $link );
4319                     if ( $add_args ) {
4320                          $link = add_query_arg( $add_args, $link );
4321                     }
4322                     $link .= $args['add_fragment'];
4323
4324                     $page_links[] = sprintf(
4325                          '<a class="page-numbers" href="%s">%s</a>',
4326                          /** This filter is documented in wp-includes/general-template.php */
4327                          esc_url( apply_filters( 'paginate_links', $link ) ),
4328                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4329                     );
4330
4331                     $dots = true;
4332                elseif ( $dots && ! $args['show_all'] ) :
4333                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4334
4335                     $dots = false;
4336                endif;
 
Line Code
4342           $link = str_replace( '%#%', $current + 1, $link );
4343           if ( $add_args ) {
4344                $link = add_query_arg( $add_args, $link );
4345           }
4346           $link .= $args['add_fragment'];
4347
4348           $page_links[] = sprintf(
4349                '<a class="next page-numbers" href="%s">%s</a>',
4350                /** This filter is documented in wp-includes/general-template.php */
4351                esc_url( apply_filters( 'paginate_links', $link ) ),
4352                $args['next_text']
4353           );
4354      endif;
4355
4356      switch ( $args['type'] ) {
4357           case 'array':
4358                return $page_links;
4359
4360           case 'list':