Support » Fixing WordPress » Show post before today

  • Resolved luciendub

    (@luciendub)


    Hi,
    I try to show posts older than today to make a “past event” page. I got this:
    <?php query_posts( array( 'cat' => '2186', 'paged' => get_query_var('paged'), 'order' => 'DESC', 'before' => '2013' ) ); ?>

    What should I put for the before parameter?

Viewing 1 replies (of 1 total)
  • Resolve on another forum:

    $args = array (
       'cat' => '2186',
       'paged' => get_query_var('paged'),
       'order' => 'DESC',
       'paged' => $paged,
       'date_query' => array(
         array(
           'before'    => array(
             'year'  => date('Y'),
             'month' => date('m'),
             'day'   => date('d')
            ),
           'inclusive' => true,
         ),
        ),
    );
    query_posts($args);

Viewing 1 replies (of 1 total)
  • The topic ‘Show post before today’ is closed to new replies.