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
4265           $page_links[] = sprintf(
4266                '<a class="prev page-numbers" href="%s">%s</a>',
4267                /**
4268                 * Filters the paginated links for the given archive pages.
4269                 *
4270                 * @since 3.0.0
4271                 *
4272                 * @param string $link The paginated link URL.
4273                 */
4274                esc_url( apply_filters( 'paginate_links', $link ) ),
4275                $args['prev_text']
4276           );
4277      endif;
4278
4279      for ( $n = 1; $n <= $total; $n++ ) :
4280           if ( $n == $current ) :
4281                $page_links[] = sprintf(
4282                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4283                     esc_attr( $args['aria_current'] ),
 
Line Code
4291                     $link = str_replace( '%#%', $n, $link );
4292                     if ( $add_args ) {
4293                          $link = add_query_arg( $add_args, $link );
4294                     }
4295                     $link .= $args['add_fragment'];
4296
4297                     $page_links[] = sprintf(
4298                          '<a class="page-numbers" href="%s">%s</a>',
4299                          /** This filter is documented in wp-includes/general-template.php */
4300                          esc_url( apply_filters( 'paginate_links', $link ) ),
4301                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4302                     );
4303
4304                     $dots = true;
4305                elseif ( $dots && ! $args['show_all'] ) :
4306                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4307
4308                     $dots = false;
4309                endif;
 
Line Code
4315           $link = str_replace( '%#%', $current + 1, $link );
4316           if ( $add_args ) {
4317                $link = add_query_arg( $add_args, $link );
4318           }
4319           $link .= $args['add_fragment'];
4320
4321           $page_links[] = sprintf(
4322                '<a class="next page-numbers" href="%s">%s</a>',
4323                /** This filter is documented in wp-includes/general-template.php */
4324                esc_url( apply_filters( 'paginate_links', $link ) ),
4325                $args['next_text']
4326           );
4327      endif;
4328
4329      switch ( $args['type'] ) {
4330           case 'array':
4331                return $page_links;
4332
4333           case 'list':