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
4243           $page_links[] = sprintf(
4244                '<a class="prev page-numbers" href="%s">%s</a>',
4245                /**
4246                 * Filters the paginated links for the given archive pages.
4247                 *
4248                 * @since 3.0.0
4249                 *
4250                 * @param string $link The paginated link URL.
4251                 */
4252                esc_url( apply_filters( 'paginate_links', $link ) ),
4253                $args['prev_text']
4254           );
4255      endif;
4256
4257      for ( $n = 1; $n <= $total; $n++ ) :
4258           if ( $n == $current ) :
4259                $page_links[] = sprintf(
4260                     '<span aria-current="%s" class="page-numbers current">%s</span>',
4261                     esc_attr( $args['aria_current'] ),
 
Line Code
4269                     $link = str_replace( '%#%', $n, $link );
4270                     if ( $add_args ) {
4271                          $link = add_query_arg( $add_args, $link );
4272                     }
4273                     $link .= $args['add_fragment'];
4274
4275                     $page_links[] = sprintf(
4276                          '<a class="page-numbers" href="%s">%s</a>',
4277                          /** This filter is documented in wp-includes/general-template.php */
4278                          esc_url( apply_filters( 'paginate_links', $link ) ),
4279                          $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
4280                     );
4281
4282                     $dots = true;
4283                elseif ( $dots && ! $args['show_all'] ) :
4284                     $page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
4285
4286                     $dots = false;
4287                endif;
 
Line Code
4293           $link = str_replace( '%#%', $current + 1, $link );
4294           if ( $add_args ) {
4295                $link = add_query_arg( $add_args, $link );
4296           }
4297           $link .= $args['add_fragment'];
4298
4299           $page_links[] = sprintf(
4300                '<a class="next page-numbers" href="%s">%s</a>',
4301                /** This filter is documented in wp-includes/general-template.php */
4302                esc_url( apply_filters( 'paginate_links', $link ) ),
4303                $args['next_text']
4304           );
4305      endif;
4306
4307      switch ( $args['type'] ) {
4308           case 'array':
4309                return $page_links;
4310
4311           case 'list':