Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $parent = get_cat_ID("photos");
- $cats = get_categories("child_of=".$parent);
- foreach ($cats as $cat) {
- query_posts("posts_per_page=1&orderby=rand&cat=".$cat->term_id);
- ?>
- <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
- <ul>
- <?php if (has_post_thumbnail()) { ?>
- <?php
- printf( '<li><a href="'.get_category_link($cat->term_id).'">'.get_the_post_thumbnail(get_the_ID(), "album-thumb").'</a><a href="'.get_category_link($cat->term_id).'">%s</a></li>',
- apply_filters('get_term', $cat->name));
- ?>
- <?php } ?>
- </ul>
- <?php endwhile; else: ?>
- <p><?php _e("Sorry, no posts matched your criteria."); ?></p>
- <?php endif; } ?>
- <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement