• Mentalhead

    (@mentalhead)


    I have this line of code:

    $args = array(
    ‘date_query’ => array(
    array(
    ‘after’ => ‘January 1st, 2015’,
    ‘before’ => ‘February 15th, 2015’,
    ‘inclusive’ => true,
    ),
    ),
    );
    $query = new WP_Query( $args );

    This code will return all the post published between Jan 1st and Feb 15th.
    My question is can I somehow create a link to the results of this query?

    For example I can go to

    localhost/wordpress?monthnum=1

    and get all posts from January, but is there a link, or can I create custom link that will accept the parameters of my date_query, so I can display all the posts that match my query?

    Basically I just want to show all posts published between specific dates on a separate page, and I want a link to that page, but I don’t know if such thing is possible.

    Just to be clear, I just want to know is there a link such as:

    localhost/wordpress?after=January1st2015&before=February15th2015

    available in WordPress so I can quickly access the query results, or is there a way to create such a link?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Link to date_query results in WordPress’ is closed to new replies.