Advertisement
Guest User

Staffer taxonomy-department query

a guest
Jan 2nd, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2.     $args = array (
  3.         'post_type' => 'staff',
  4.         'tax_query' =>
  5.             array(
  6.                 array(
  7.                     'taxonomy' => 'department',
  8.                     'field'    => 'slug',
  9.                     'terms'    => 'your_department',
  10.                     ),
  11.                 ),
  12.                 );
  13.         $department_query = new WP_Query( $args );
  14.  
  15.         if ( $department_query->have_posts() ) :
  16.             while ($department_query->have_posts()) : ?>
  17.             <ul class="staffer-archive-list">
  18.             <?php
  19.                 $department_query->the_post();
  20.                  ?>
  21.                  <li>
  22.                     <header class="staffer-staff-header">
  23.                         <h3 class="staffer-staff-title">
  24.                             <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  25.                         </h3>
  26.                     </header>
  27.                     <?php
  28.                         the_post_thumbnail ( 'medium', array ('class' => 'alignleft') );
  29.                         the_excerpt();
  30.                             ?>
  31.                 </li>
  32.                 <?php
  33.                     endwhile;
  34.                         endif;
  35.                          ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement