Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_previous_post_join

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
375      }
376
377      $sql_exclude_cats = '';
378      if ( !empty($excluded_categories) ) {
379           $blah = explode(' and ', $excluded_categories);
380           $posts_in_ex_cats = get_objects_in_term($blah, 'category');
381           $posts_in_ex_cats_sql = 'AND p.ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
382      }
383
384      $join  = apply_filters( 'get_previous_post_join', $join, $in_same_cat, $excluded_categories );
385      $where = apply_filters( 'get_previous_post_where', "WHERE p.post_date < '$current_post_date' AND p.post_type = 'post' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $in_same_cat, $excluded_categories );
386      $sort  = apply_filters( 'get_previous_post_sort', 'ORDER BY p.post_date DESC LIMIT 1' );
387
388      return @$wpdb->get_row("SELECT p.ID, p.post_title FROM $wpdb->posts AS p $join $where $sort");
389 }
390
391 function get_next_post($in_same_cat = false, $excluded_categories = '') {
392      global $post, $wpdb;
393