title: Nested Year/Month/Post title archive
body: <p>I'm trying to create a nested post archive for my news section in wordpress theme:</p>
  
  <pre><code>&lt;div class="blog-list-archive"&gt;
  
  &lt;?php
  /**/
  $years = $wpdb-&gt;get_col("SELECT DISTINCT YEAR(post_date)
  FROM $wpdb-&gt;posts WHERE post_status = 'publish'
  AND post_type = 'post' ORDER BY post_date DESC");
  foreach($years as $year) :
  ?&gt;
  &lt;li&gt;&lt;a href="JavaScript:void()"&gt;&lt;?php echo $year; ?&gt;&lt;/a&gt;
  
      &lt;ul class="archive-sub-menu"&gt;
          &lt;?    $months = $wpdb-&gt;get_col("SELECT DISTINCT MONTH(post_date)
          FROM $wpdb-&gt;posts WHERE post_status = 'publish' AND post_type = 'post'
          AND YEAR(post_date) = '".$year."' ORDER BY post_date DESC");
          foreach($months as $month) :
          ?&gt;
              &lt;li&gt;&lt;a href="&lt;?php echo get_month_link($year, $month); ?&gt;"&gt;
  
                  &lt;?php echo date( 'F', mktime(0, 0, 0, $month) );?&gt;&lt;/a&gt;
  
              &lt;/li&gt;
  
          &lt;?php endforeach;?&gt;
  
      &lt;/ul&gt;
  
  &lt;/li&gt;
  
  &lt;?php endforeach; ?&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>How can I extend this to show the post titles under each month? Also I just want to fetch the posts under the 'news' category which is '13'.</p>
  
  <p>Just to illustrate i need this format:</p>
  
  <ul>
  <li><p>2013  </p>
  
  <ul>
  <li>January</li>
  <li>post title 1</li>
  <li>post title 2</li>
  <li>post title 3</li>
  </ul></li>
  <li><p>2012  </p>
  
  <ul>
  <li>December</li>
  <li>post title 1</li>
  <li>post title 2</li>
  <li>post title 3</li>
  <li>November</li>
  <li>post title 1</li>
  <li>post title 2</li>
  </ul></li>
  </ul>