Advertisement
Guest User

Untitled

a guest
Dec 20th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. `<?php $this_term = get_queried_object();
  2. $args = array(
  3.     'parent' => $this_term->term_id,
  4.     'orderby' => 'slug',
  5.     'hide_empty' => true
  6. );
  7.  
  8. $child_terms = get_terms( $this_term->taxonomy, $args );
  9.  
  10. foreach ( $child_terms as $term ):
  11.  
  12.     $query = new WP_Query(
  13.         array(
  14.             'post_type' => 'sfwd-courses',
  15.             'tax_query' => array(
  16.                 'relation' => 'AND',
  17.                 array(
  18.                     'taxonomy' => $this_term->taxonomy,
  19.                     'field'    => 'slug',
  20.                     'terms'    => array( $term->slug )
  21.                 )
  22.             )    
  23.         )
  24.     );?>
  25.     <h3 class="child_term"><?php echo $term->name; ?></h3>
  26.     <?php if ( $query->have_posts() ): ?>
  27.         <ul id="focus_areas_list">
  28.         <?php while($query->have_posts()) : $query->the_post(); ?>
  29.             <li id="module-<?php the_ID(); ?>" class="medium-4 columns single_f_area">
  30.                 <a>">
  31.                     <div class="medium-12 columns thumb_image" style="background: url(<?php if ( has_post_thumbnail() ) { the_post_thumbnail_url(); } ?>) no-repeat center; background-size:cover;">
  32.                         <h5>
  33.                             <?php the_title(); ?>
  34.                             <?php if ( !empty( get_the_excerpt() ) ): ?>
  35.                             <span class="cat_description"><?php echo wp_trim_words( get_the_excerpt(), '10' , '...'); ?></span>
  36.                             <?php endif; ?>
  37.                         </h5>
  38.                     </div>
  39.                     <h6 class="f_area_home_title module_page">
  40.                         View Module
  41.                     </h6>
  42.                 </a>
  43.             </li>
  44.         <?php endwhile; ?>
  45.         </ul>
  46.     <?php endif; ?>
  47. <?php endforeach; ?>
  48. `
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement