WordPress.org

Support

Support » How-To and Troubleshooting » How to use WP_Query to get posts from date archive page

How to use WP_Query to get posts from date archive page

  • fooentes

    @fooentes

    So, I’m using this in category.php

    $query = new WP_Query( array(‘cat’ => $cat, ‘posts_per_page’ => 1, ‘offset’ => 3 ) );

    this in search.php

    $query = new WP_Query( array(‘s’ => get_search_query(), ‘posts_per_page’ => 1, ‘offset’ => 3 ) );

    But I cannot find a way to do the same thing inside my archive.php, which I’m going to use only for dates.

    For example, when you visit mysite.com/?m=201301 I need to query only the posts from this date range.

    Is that possible?
    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to use WP_Query to get posts from date archive page’ is closed to new replies.
Skip to toolbar