title: Showing post and counter in a nesting months under years in a wordpress archive dropdown list
body: <p>I've found this script nesting months under years in a wordpress archive dropdown list.</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;
  </code></pre>
  
  <p></li></p>
  
  
  
  <p>    </p>
  
  <pre><code>The output is this :
  2014
     January
     October
  2013
     January
  </code></pre>
  
  <p>The script is limited and doesn't show the post under that month. I have tried to add it but no luck, i haven't coded for ages and can't figure out the solution. Other than showing posts i've wanted to add a post counter on year ( shows total number of posts on that year ) and month ( shows total number of posts on that month )</p>
  
  <hr>
  
  <p>The jquery script to show the dropdown list</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  jQuery(document).ready(function() {
  
  jQuery('.blog-list-archive li ul').hide();
  jQuery('.blog-list-archive li a').click(function(){
      jQuery(this).parent().addClass('selected');
      jQuery(this).parent().children('ul').slideDown(250);
      jQuery(this).parent().siblings().children('ul').slideUp(250);
      jQuery(this).parent().siblings().removeClass('selected');
  });
  });
  
  &lt;/script&gt;
  </code></pre>