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
4164           $page_links[] = sprintf(
4165                '<a class="prev page-numbers" href="%s">%s</a>',
4166                /**
4167                 * Filters the paginated links for the given archive pages.
4168                 *
4169                 * @since 3.0.0
4170                 *
4171                 * @param string $link The paginated link URL.
4172                 */
4173                esc_url( apply_filters( 'paginate_links', $link ) ),
4174                $args['prev_text']
4175           );
4176      endif;
4177
4178      for ( $n = 1; $n <= $total; $n++ ) :
4179           if ( $n == $current ) :
4180                $page_links[] = sprintf(
4181                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4182                     esc_attr( $args['aria_current'] ),
 
Line Code
4190                     $link = str_replace( '%#%', $n, $link );
4191                     if ( $add_args ) {
4192                          $link = add_query_arg( $add_args, $link );
4193                     }
4194                     $link .= $args['add_fragment'];
4195
4196                     $page_links[] = sprintf(
4197                          '<a class="page-numbers" href="%s">%s</a>',
4198                          /** This filter is documented in wp-includes/general-template.php */
4199                          esc_url( apply_filters( 'paginate_links', $link ) ),
4200                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4201                     );
4202
4203                     $dots = true;
4204                elseif ( $dots && ! $args['show_all'] ) :
4205                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4206
4207                     $dots = false;
4208                endif;
 
Line Code
4214           $link = str_replace( '%#%', $current + 1, $link );
4215           if ( $add_args ) {
4216                $link = add_query_arg( $add_args, $link );
4217           }
4218           $link .= $args['add_fragment'];
4219
4220           $page_links[] = sprintf(
4221                '<a class="next page-numbers" href="%s">%s</a>',
4222                /** This filter is documented in wp-includes/general-template.php */
4223                esc_url( apply_filters( 'paginate_links', $link ) ),
4224                $args['next_text']
4225           );
4226      endif;
4227
4228      switch ( $args['type'] ) {
4229           case 'array':
4230                return $page_links;
4231
4232           case 'list':