Advertisement
Guest User

Current Code

a guest
Jan 10th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1.     <?php
  2.         $parent = get_cat_ID("photos");
  3.         $cats = get_categories("child_of=".$parent);
  4.         foreach ($cats as $cat) {
  5.         query_posts("posts_per_page=1&orderby=rand&cat=".$cat->term_id);
  6.     ?>
  7.         <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  8.             <ul>
  9.                 <?php if (has_post_thumbnail()) { ?>
  10.                     <?php
  11.                         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>',
  12.                         apply_filters('get_term', $cat->name));
  13.                     ?>
  14.                 <?php } ?>
  15.             </ul>
  16.         <?php endwhile; else: ?>
  17.             <p><?php _e("Sorry, no posts matched your criteria."); ?></p>
  18.         <?php endif; } ?>
  19.     <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement