How can I load posts starting from, and including, the current post?

I’m loading some posts using this argument:

$args = array(
 'category__in' => $catID,
 'category__not_in' => 1,
 'posts_per_page'=>10,
 'date_query' => array( array( 'before' => get_the_date() ) )
);

The problem I’m having is that I want to include the actual post I’m on, this carries on after the current post.

Read More

I’ve tried adding 'offset'=>-1 but that doesn’t seem to work.

How can I load posts starting from, and including, the current post?

Edit: I’ve tried using inclusive but it didn’t seem to work.

<? php
$args = array(
    'category__in' = > $catID,
    'category__not_in' = > 1,
    'posts_per_page' = > 10,
    'date_query' = > array('before' = > get_the_date(), 'inclusive' = > true));
$loop = new WP_Query($args);
while ($loop - > have_posts()) {
    $loop - > the_post();
    get_template_part('sidebar-posts-template');
}
wp_reset_postdata(); ?>

Related posts

Leave a Reply