Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.83 KB  |  hits: 14  |  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. <?php
  2. $taxonomy = 'album';
  3. $term_args=array(
  4.   'orderby' => 'name',
  5.   'order' => 'ASC',
  6.   'child_of' => 3
  7. );
  8. $terms = get_terms($taxonomy,$term_args);
  9. if ($terms) {
  10.   foreach( $terms as $term ) {
  11.     $args=array(
  12.       "$param_type" => array($term->term_id),
  13.       'post_type' => 'foto',
  14.       'showposts' => 1,
  15.       'album' => 'comercial',
  16.       'orderby' => rand
  17.     );
  18.     $my_query = null;
  19.     $my_query = new WP_Query($args);
  20.     if( $my_query->have_posts() ) {
  21.       echo $term->name;
  22.       while ($my_query->have_posts()) : $my_query->the_post(); ?>
  23.         <a href="<?php echo get_term_link( $term->term_id, 'album'); ?>"><img src="<?php echo get_image(); ?>" alt="<?php the_title_rss(); ?>" /></a>
  24.        <?php
  25.       endwhile;
  26.     }
  27.   }
  28. }
  29. wp_reset_query();  // Restore global post data stomped by the_post().
  30. ?>