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 |
|---|---|
| 2520 | $link .= $args['add_fragment']; |
| 2521 | |
| 2522 | /** |
| 2523 | * Filter the paginated links for the given archive pages. |
| 2524 | * |
| 2525 | * @since 3.0.0 |
| 2526 | * |
| 2527 | * @param string $link The paginated link URL. |
| 2528 | */ |
| 2529 | $page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>'; |
| 2530 | endif; |
| 2531 | for ( $n = 1; $n <= $total; $n++ ) : |
| 2532 | if ( $n == $current ) : |
| 2533 | $page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>"; |
| 2534 | $dots = true; |
| 2535 | else : |
| 2536 | if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) : |
| 2537 | $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
| 2538 | $link = str_replace( '%#%', $n, $link ); |
| 2539 | if ( $add_args ) |
| 2540 | $link = add_query_arg( $add_args, $link ); |
| 2541 | $link .= $args['add_fragment']; |
| 2542 | |
| 2543 | /** This filter is documented in wp-includes/general-template.php */ |
| 2544 | $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>"; |
| 2545 | $dots = true; |
| 2546 | elseif ( $dots && ! $args['show_all'] ) : |
| 2547 | $page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>'; |
| 2548 | $dots = false; |
| 2549 | endif; |
| 2550 | endif; |
| 2551 | endfor; |
| 2552 | if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) : |
| 2553 | $link = str_replace( '%_%', $args['format'], $args['base'] ); |
| 2554 | $link = str_replace( '%#%', $current + 1, $link ); |
| 2555 | if ( $add_args ) |
| 2556 | $link = add_query_arg( $add_args, $link ); |
| 2557 | $link .= $args['add_fragment']; |
| 2558 | |
| 2559 | /** This filter is documented in wp-includes/general-template.php */ |
| 2560 | $page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>'; |
| 2561 | endif; |
| 2562 | switch ( $args['type'] ) { |
| 2563 | case 'array' : |
| 2564 | return $page_links; |
| 2565 | |
| 2566 | case 'list' : |
| 2567 | $r .= "<ul class='page-numbers'>\n\t<li>"; |
| 2568 | $r .= join("</li>\n\t<li>", $page_links); |
| 2569 | $r .= "</li>\n</ul>\n"; |