Advertisement
Guest User

Smart Archive Reloaded Custom_Generator Months without links

a guest
May 29th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement