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
327           $blah = explode(' and ', $excluded_categories);
328           foreach ( $blah as $category ) {
329                $category = intval($category);
330                $sql_cat_ids = " OR pc.category_ID = '$category'";
331           }
332           $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");
333           $posts_in_ex_cats_sql = 'AND ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
334      }
335
336      $join  = apply_filters( 'get_next_post_join', $join, $in_same_cat, $excluded_categories );
337      $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 );
338      $sort  = apply_filters( 'get_next_post_sort', 'ORDER BY post_date ASC LIMIT 1' );
339
340      return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join $where $sort");
341 }
342
343
344 function previous_post_link($format='« %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
345