Advertisement
Guest User

Untitled

a guest
Jun 26th, 2012
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php get_header(); ?>
  2. <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  3. <div class="content-block designer-alpha">
  4.   <?php #the_content();
  5.                         $termchildren = get_term_children( 57, "wpsc_product_category" );
  6.                         $firstLetter = "-1";
  7.                         $desiredColumns = 0;  //you can change this!
  8.                         echo "<table style='margin: 0 auto; width: 100%;'><tr><td>";
  9.                         foreach ($termchildren as $key => $child) {
  10.                             $term = get_term_by( 'id', $child, "wpsc_product_category" );
  11.                             #print_r($term);
  12.                             if ($term->name[0] !== $firstLetter) {
  13.                                  if( $desiredColumns!=0 && $desiredColumns%5==0) echo "</td></tr><tr>";
  14.                                  $firstLetter = $term->name[0];
  15.                                  if( $desiredColumns!=0 && $desiredColumns%5 == 0 )
  16.                                     echo "<td>";
  17.                                  else if($key!=0)
  18.                                     echo "</td><td>";
  19.                                  
  20.                                  echo "<h4>".strtoupper($firstLetter)."</h4>";
  21.                                  $desiredColumns++;
  22.                             }
  23.                             echo '<a href="' . get_term_link( $term->slug, "wpsc_product_category" ) . '">' . $term->name . '</a><br />';
  24.                        
  25.                         }
  26.                         echo "</td><tr></table>";
  27.                     ?>
  28.   <div class="content"> </div>
  29.   <div class="clear"></div>
  30. </div>
  31. <?php endwhile; ?>
  32. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement