Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Smart Archive Reloaded Custom_Generator Months without links

By: a guest on May 29th, 2012  |  syntax: PHP  |  size: 0.98 KB  |  views: 68  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class SAR_Custom_Generator extends SAR_Generator {
  2.     // The list
  3.     protected function generate_list() {
  4.         $months_long = $this->get_months();
  5.  
  6.         $list = '';
  7.         foreach ( $this->get_years_with_posts( 'desc' ) as $year ) {
  8.             foreach ( range( 12, 1 ) as $i ) {
  9.                 // Get post links for current month
  10.                 $post_list = $this->generate_post_list( $year, $i, "\n\t\t" );
  11.  
  12.                 if ( !$post_list )
  13.                     continue;
  14.  
  15.                 // Set title format
  16.                 if ( $this->args->anchors )
  17.                     $el = "h2 id='{$year}{$i}'";
  18.                 else
  19.                     $el = "h2";
  20.  
  21.                 // Append to list
  22.                 $list .=
  23.                 html( $el, $months_long[$i] . ' ' . $year );
  24.  
  25.                 $list .= html( 'ul', $post_list );
  26.             } // end month block
  27.         } // end year block
  28.  
  29.         return html( 'div id="smart-archives-list"', $list );
  30.     }
  31. }