WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 3013 | $link .= $args['add_fragment']; |
| 3014 | |
| 3015 | /** |
| 3016 | * Filter the paginated links for the given archive pages. |
| 3017 | * |
| 3018 | * @since 3.0.0 |
| 3019 | * |
| 3020 | * @param string $link The paginated link URL. |
| 3021 | */ |
| 3022 | $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; |
| 3023 | endif; |
| 3024 | for ( $n = 1; $n <= $total; $n++ ) : |
| 3025 | if ( $n == $current ) : |
| 3026 | $page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>"; |
| 3027 | $dots = true; |
| 3028 | else : |
| 3029 | if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : |
| 3030 | $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
| 3031 | $link = str_replace( '%#%', $n, $link ); |
| 3032 | if ( $add_args ) |
| 3033 | $link = add_query_arg( $add_args, $link ); |
| 3034 | $link .= $args['add_fragment']; |
| 3035 | |
| 3036 | /** This filter is documented in wp-includes/general-template.php */ |
| 3037 | $page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</a>"; |
| 3038 | $dots = true; |
| 3039 | elseif ( $dots && ! $args['show_all'] ) : |
| 3040 | $page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>'; |
| 3041 | $dots = false; |
| 3042 | endif; |
| 3043 | endif; |
| 3044 | endfor; |
| 3045 | if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) : |
| 3046 | $link = str_replace( '%_%', $args['format'], $args['base'] ); |
| 3047 | $link = str_replace( '%#%', $current + 1, $link ); |
| 3048 | if ( $add_args ) |
| 3049 | $link = add_query_arg( $add_args, $link ); |
| 3050 | $link .= $args['add_fragment']; |
| 3051 | |
| 3052 | /** This filter is documented in wp-includes/general-template.php */ |
| 3053 | $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>'; |
| 3054 | endif; |
| 3055 | switch ( $args['type'] ) { |
| 3056 | case 'array' : |
| 3057 | return $page_links; |
| 3058 | |
| 3059 | case 'list' : |
| 3060 | $r .= "<ul class='page-numbers'>\n\t<li>"; |
| 3061 | $r .= join("</li>\n\t<li>", $page_links); |
| 3062 | $r .= "</li>\n</ul>\n"; |