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
4731           $page_links[] = sprintf(
4732                '<a class="prev page-numbers" href="%s">%s</a>',
4733                /**
4734                 * Filters the paginated links for the given archive pages.
4735                 *
4736                 * @since 3.0.0
4737                 *
4738                 * @param string $link The paginated link URL.
4739                 */
4740                esc_url( apply_filters( 'paginate_links', $link ) ),
4741                $args['prev_text']
4742           );
4743      endif;
4744
4745      for ( $n = 1; $n <= $total; $n++ ) :
4746           if ( $n === $current ) :
4747                $page_links[] = sprintf(
4748                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4749                     esc_attr( $args['aria_current'] ),
 
Line Code
4757                     $link = str_replace( '%#%', $n, $link );
4758                     if ( $add_args ) {
4759                          $link = add_query_arg( $add_args, $link );
4760                     }
4761                     $link .= $args['add_fragment'];
4762
4763                     $page_links[] = sprintf(
4764                          '<a class="page-numbers" href="%s">%s</a>',
4765                          /** This filter is documented in wp-includes/general-template.php */
4766                          esc_url( apply_filters( 'paginate_links', $link ) ),
4767                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4768                     );
4769
4770                     $dots = true;
4771                elseif ( $dots && ! $args['show_all'] ) :
4772                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4773
4774                     $dots = false;
4775                endif;
 
Line Code
4781           $link = str_replace( '%#%', $current + 1, $link );
4782           if ( $add_args ) {
4783                $link = add_query_arg( $add_args, $link );
4784           }
4785           $link .= $args['add_fragment'];
4786
4787           $page_links[] = sprintf(
4788                '<a class="next page-numbers" href="%s">%s</a>',
4789                /** This filter is documented in wp-includes/general-template.php */
4790                esc_url( apply_filters( 'paginate_links', $link ) ),
4791                $args['next_text']
4792           );
4793      endif;
4794
4795      switch ( $args['type'] ) {
4796           case 'array':
4797                return $page_links;
4798
4799           case 'list':