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
4717           $page_links[] = sprintf(
4718                '<a class="prev page-numbers" href="%s">%s</a>',
4719                /**
4720                 * Filters the paginated links for the given archive pages.
4721                 *
4722                 * @since 3.0.0
4723                 *
4724                 * @param string $link The paginated link URL.
4725                 */
4726                esc_url( apply_filters( 'paginate_links', $link ) ),
4727                $args['prev_text']
4728           );
4729      endif;
4730
4731      for ( $n = 1; $n <= $total; $n++ ) :
4732           if ( $n === $current ) :
4733                $page_links[] = sprintf(
4734                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4735                     esc_attr( $args['aria_current'] ),
 
Line Code
4743                     $link = str_replace( '%#%', $n, $link );
4744                     if ( $add_args ) {
4745                          $link = add_query_arg( $add_args, $link );
4746                     }
4747                     $link .= $args['add_fragment'];
4748
4749                     $page_links[] = sprintf(
4750                          '<a class="page-numbers" href="%s">%s</a>',
4751                          /** This filter is documented in wp-includes/general-template.php */
4752                          esc_url( apply_filters( 'paginate_links', $link ) ),
4753                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4754                     );
4755
4756                     $dots = true;
4757                elseif ( $dots && ! $args['show_all'] ) :
4758                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4759
4760                     $dots = false;
4761                endif;
 
Line Code
4767           $link = str_replace( '%#%', $current + 1, $link );
4768           if ( $add_args ) {
4769                $link = add_query_arg( $add_args, $link );
4770           }
4771           $link .= $args['add_fragment'];
4772
4773           $page_links[] = sprintf(
4774                '<a class="next page-numbers" href="%s">%s</a>',
4775                /** This filter is documented in wp-includes/general-template.php */
4776                esc_url( apply_filters( 'paginate_links', $link ) ),
4777                $args['next_text']
4778           );
4779      endif;
4780
4781      switch ( $args['type'] ) {
4782           case 'array':
4783                return $page_links;
4784
4785           case 'list':