Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_next_post_where

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

Line Code
409
410      $sql_exclude_cats = '';
411      if ( !empty($excluded_categories) ) {
412           $blah = explode(' and ', $excluded_categories);
413           $posts_in_ex_cats = get_objects_in_term($blah, 'category');
414           $posts_in_ex_cats_sql = 'AND p.ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
415      }
416
417      $join  = apply_filters( 'get_next_post_join', $join, $in_same_cat, $excluded_categories );
418      $where = apply_filters( 'get_next_post_where', "WHERE p.post_date > '$current_post_date' AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql AND p.ID != $post->ID", $in_same_cat, $excluded_categories );
419      $sort  = apply_filters( 'get_next_post_sort', 'ORDER BY p.post_date ASC LIMIT 1' );
420
421      return @$wpdb->get_row("SELECT p.ID, p.post_title FROM $wpdb->posts AS p $join $where $sort");
422 }
423
424
425 function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
426
427      if ( is_attachment() )