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
4156           $page_links[] = sprintf(
4157                '<a class="prev page-numbers" href="%s">%s</a>',
4158                /**
4159                 * Filters the paginated links for the given archive pages.
4160                 *
4161                 * @since 3.0.0
4162                 *
4163                 * @param string $link The paginated link URL.
4164                 */
4165                esc_url( apply_filters( 'paginate_links', $link ) ),
4166                $args['prev_text']
4167           );
4168      endif;
4169
4170      for ( $n = 1; $n <= $total; $n++ ) :
4171           if ( $n == $current ) :
4172                $page_links[] = sprintf(
4173                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4174                     esc_attr( $args['aria_current'] ),
 
Line Code
4182                     $link = str_replace( '%#%', $n, $link );
4183                     if ( $add_args ) {
4184                          $link = add_query_arg( $add_args, $link );
4185                     }
4186                     $link .= $args['add_fragment'];
4187
4188                     $page_links[] = sprintf(
4189                          '<a class="page-numbers" href="%s">%s</a>',
4190                          /** This filter is documented in wp-includes/general-template.php */
4191                          esc_url( apply_filters( 'paginate_links', $link ) ),
4192                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4193                     );
4194
4195                     $dots = true;
4196                elseif ( $dots && ! $args['show_all'] ) :
4197                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4198
4199                     $dots = false;
4200                endif;
 
Line Code
4206           $link = str_replace( '%#%', $current + 1, $link );
4207           if ( $add_args ) {
4208                $link = add_query_arg( $add_args, $link );
4209           }
4210           $link .= $args['add_fragment'];
4211
4212           $page_links[] = sprintf(
4213                '<a class="next page-numbers" href="%s">%s</a>',
4214                /** This filter is documented in wp-includes/general-template.php */
4215                esc_url( apply_filters( 'paginate_links', $link ) ),
4216                $args['next_text']
4217           );
4218      endif;
4219
4220      switch ( $args['type'] ) {
4221           case 'array':
4222                return $page_links;
4223
4224           case 'list':