Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_next_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
371           $blah = explode(' and ', $excluded_categories);
372           foreach ( $blah as $category ) {
373                $category = intval($category);
374                $sql_cat_ids = " OR pc.category_ID = '$category'";
375           }
376           $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");
377           $posts_in_ex_cats_sql = 'AND ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
378      }
379
380      $join  = apply_filters( 'get_next_post_join', $join, $in_same_cat, $excluded_categories );
381      $where = apply_filters( 'get_next_post_where', "WHERE post_date > '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql AND ID != $post->ID", $in_same_cat, $excluded_categories );
382      $sort  = apply_filters( 'get_next_post_sort', 'ORDER BY post_date ASC LIMIT 1' );
383
384      return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join $where $sort");
385 }
386
387
388 function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
389