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 4 times in this file.
| Line | Code |
|---|---|
| 305 | |
| 306 | if ( is_attachment() ) |
| 307 | $post = & get_post($GLOBALS['post']->post_parent); |
| 308 | else |
| 309 | $post = get_previous_post($in_same_cat, $excluded_categories); |
| 310 | |
| 311 | if ( !$post ) |
| 312 | return; |
| 313 | |
| 314 | $title = apply_filters('the_title', $post->post_title, $post); |
| 315 | $string = '<a href="'.get_permalink($post->ID).'">'; |
| 316 | $link = str_replace('%title', $title, $link); |
| 317 | $link = $pre . $string . $link . '</a>'; |
| 318 | |
| 319 | $format = str_replace('%link', $link, $format); |
| 320 | |
| 321 | echo $format; |
| 322 | } |
| 323 | |
| 324 | function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') { |
| 325 | $post = get_next_post($in_same_cat, $excluded_categories); |
| 326 | |
| 327 | if ( !$post ) |
| 328 | return; |
| 329 | |
| 330 | $title = apply_filters('the_title', $post->post_title, $post); |
| 331 | $string = '<a href="'.get_permalink($post->ID).'">'; |
| 332 | $link = str_replace('%title', $title, $link); |
| 333 | $link = $string . $link . '</a>'; |
| 334 | $format = str_replace('%link', $link, $format); |
| 335 | |
| 336 | echo $format; |
| 337 | } |
| 338 | |
| 339 | |
| Line | Code |
| 346 | $in_same_cat = true; |
| 347 | |
| 348 | $post = get_previous_post($in_same_cat, $excluded_categories); |
| 349 | |
| 350 | if ( !$post ) |
| 351 | return; |
| 352 | |
| 353 | $string = '<a href="'.get_permalink($post->ID).'">'.$previous; |
| 354 | if ( 'yes' == $title ) |
| 355 | $string .= apply_filters('the_title', $post->post_title, $post); |
| 356 | $string .= '</a>'; |
| 357 | $format = str_replace('%', $string, $format); |
| 358 | echo $format; |
| 359 | } |
| 360 | |
| 361 | // Deprecated. Use next_post_link(). |
| 362 | function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') { |
| 363 | |
| 364 | if ( empty($in_same_cat) || 'no' == $in_same_cat ) |
| Line | Code |
| 367 | $in_same_cat = true; |
| 368 | |
| 369 | $post = get_next_post($in_same_cat, $excluded_categories); |
| 370 | |
| 371 | if ( !$post ) |
| 372 | return; |
| 373 | |
| 374 | $string = '<a href="'.get_permalink($post->ID).'">'.$next; |
| 375 | if ( 'yes' == $title ) |
| 376 | $string .= apply_filters('the_title', $post->post_title, $nextpost); |
| 377 | $string .= '</a>'; |
| 378 | $format = str_replace('%', $string, $format); |
| 379 | echo $format; |
| 380 | } |
| 381 | |
| 382 | function get_pagenum_link($pagenum = 1) { |
| 383 | global $wp_rewrite; |
| 384 | |
| 385 | $qstr = $_SERVER['REQUEST_URI']; |