
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 0.83 KB | hits: 14 | expires: Never
<?php
$taxonomy = 'album';
$term_args=array(
'orderby' => 'name',
'order' => 'ASC',
'child_of' => 3
);
$terms = get_terms($taxonomy,$term_args);
if ($terms) {
foreach( $terms as $term ) {
$args=array(
"$param_type" => array($term->term_id),
'post_type' => 'foto',
'showposts' => 1,
'album' => 'comercial',
'orderby' => rand
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo $term->name;
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php echo get_term_link( $term->term_id, 'album'); ?>"><img src="<?php echo get_image(); ?>" alt="<?php the_title_rss(); ?>" /></a>
<?php
endwhile;
}
}
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>