php - Get URL for a date_query results in Wordpress -


i have 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 return post published between jan 1st , feb 15th. question can somehow create link results of query?

for example can go

localhost/wordpress?monthnum=1  

and posts january, there link, or can create custom link accept parameters of date_query, can display posts match query?

basically want show posts published between specific dates on separate page, , want link page, don't know if such thing possible.

what try query string ?! example :

  localhost/wordpress?monthnum=1  

will pass $_get variable current page , can value :

  $month=$_get['monthnum']; 

then can parse value specific month example: $stringdate='the default date'; if($month==1) $stringdate='january 1st, 2015'; pass value query :

        $args = array(         'date_query' => array(         array(         'after'     => $stringdate,         'before'    => 'february 15th, 2015',         'inclusive' => true,         ),         ),     );     $query = new wp_query( $args ); 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -