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