Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 8th, 2012  |  syntax: None  |  size: 1.46 KB  |  views: 30  |  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. //getting the child categories
  2. $allcats = get_categories('child_of='.get_query_var('cat'));
  3. foreach ($allcats as $cat) :
  4. $args = array(
  5.  'category__in' => array($cat->term_id)
  6. );
  7.  
  8. $customInCatQuery = new WP_Query($args);
  9.  
  10. if ($customInCatQuery->have_posts()) :
  11. echo '<div class="menupageContent">';
  12.         //GETTING THE IMAGES FROM THE PLUGIN SET ON THE POST PARENT
  13.         $terms = apply_filters( 'taxonomy-images-get-terms', '' );
  14.         if ( ! empty( $terms ) ) {
  15.         foreach( (array) $terms as $term ) {
  16.                 if($term->term_id == $cat->term_id) {
  17.                   echo wp_get_attachment_image( $term->image_id, 'menu' );
  18.                 }
  19.         }
  20.         }
  21. //DISPLAY THE NAME OF THE CATEGORY PARENT
  22. echo '<h3>'.$cat->name.'</h3>';
  23. echo '<ul>';    
  24. while ($customInCatQuery->have_posts()) : $customInCatQuery->the_post(); ?>
  25.  
  26. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  27.  
  28.  <?php
  29.  endwhile;
  30.  echo '</ul></div><!--end menupageContent-->';
  31.  
  32.  ?>
  33.  
  34.  <?php else :
  35.  echo 'No post published in:'.$cat->name;                
  36.  endif;
  37.  wp_reset_query();
  38.  endforeach;
  39.  
  40.  ?>
  41.   <?php if ( $wp_query->max_num_pages > 1 ) : ?>
  42.       <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'paradiso' ) ); ?></div>
  43.       <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'paradiso' ) ); ?></div>
  44.     <?php endif; ?>