Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. function custom_loop() {
  2.  
  3.     global $paged;
  4.     $args = array('post_type' => 'PostType');
  5.  
  6. $parentCatID = '114';
  7. $childCats = get_categories( 'child_of='.$parentCatID );
  8. if(is_array($childCats)):
  9. foreach($childCats as $child){ ?>
  10. <h2><?php echo $child->name; ?></h2>
  11. <?php query_posts('cat='.$child->term_id);
  12. while(have_posts()): the_post(); $do_not_duplicate = $post->ID; ?>
  13. <!-- POST CODE -->
  14. <div class="post">
  15.  <?php if(has_post_thumbnail()) : ?>
  16.  <?php
  17.     $thumbnail_id=get_the_post_thumbnail($post->ID);
  18.     preg_match ('/src="(.*)" class/',$thumbnail_id,$link);
  19.     $str = get_bloginfo('stylesheet_directory') . '/timthumb/timthumb.php?src=' . $link[1] . '&h=90&w=146&zc=1';
  20.  ?>
  21.  <a class="test" href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
  22.  <img src="<?php echo $str ?>"   />
  23.  </a>
  24. <h3><?php echo the_title(); ?></h3>
  25. <?php endif; ?>
  26. </div>
  27. <!-- END POST CODE -->
  28. <?php
  29. endwhile;
  30. echo '<br style="clear:both;" />';
  31. wp_reset_query();
  32. }
  33. endif;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement