I'm wondering the way i could possibly get the final three posts before (and after) a particular date.

I had been searching at query_publish however i can't decipher it.

I am searching to get this done in functions.php. Ideally, it might return just fundamental webpage stuff.. title, first image, num_comments, etc. I don't have to query the entire article.

EDIT: I'd like all of this completed in one function.. you will find explanations available regarding how to give a filter function.. which I'd rather not do. When the functionality might be simply put into add_filter(...) that might be fine.

Any help could be greatly appreciated!


Got'er. Uses AJAX. Appreciate as being a baller PHP (inner functions).

function ajax_get_next_posts($wp) {
    if(!$_POST['date']) return 'error';

    function filter_where($where = '') {
            $where .= " AND post_date <= '{$_POST['date']}'";
        return $where;
    add_filter('posts_where', 'filter_where');
    $posts = query_posts('posts_per_page=3');