Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_previous_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
335           foreach ( $blah as $category ) {
336                $category = intval($category);
337                $sql_cat_ids = " OR pc.category_ID = '$category'";
338           }
339           $posts_in_ex_cats = $wpdb->get_col("SELECT p.ID FROM $wpdb->posts p LEFT JOIN $wpdb->post2cat pc ON pc.post_id=p.ID WHERE 1 = 0 $sql_cat_ids GROUP BY p.ID");
340           $posts_in_ex_cats_sql = 'AND ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
341      }
342
343      $join  = apply_filters( 'get_previous_post_join', $join, $in_same_cat, $excluded_categories );
344      $where = apply_filters( 'get_previous_post_where', "WHERE post_date < '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql", $in_same_cat, $excluded_categories );
345      $sort  = apply_filters( 'get_previous_post_sort', 'ORDER BY post_date DESC LIMIT 1' );
346
347      return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join $where $sort");
348 }
349
350 function get_next_post($in_same_cat = false, $excluded_categories = '') {
351      global $post, $wpdb;
352
353      if( !is_single() || is_attachment() )