Advertisement
deeve

template query

May 18th, 2012
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2.                 $m = $_GET['themonth'];
  3.                 $y = $_GET['theyear'];             
  4.                 $cat = $_GET['cat'];
  5.                
  6.                 $args = array(
  7.                     'posts_per_page' => -1,
  8.                     'monthnum'   => $m,
  9.                     'year'       => $y,
  10.                     'cat'        => $cat // I Made this a variable instead of a hardcoded '7', in case you ever want to send it a different category -G
  11.                 );
  12.                 $cat_q = new WP_Query( $args );
  13.                 if ( $cat_q->have_posts() ) {
  14.                     $p = 0;
  15.                     while ( $cat_q->have_posts() ) {
  16.                         $cat_q->the_post();
  17.                         // For long strings of HTML, you can just close PHP and reopen it when you need it again -G ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement