Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Loop through each category "team" and output the posts */
- // establish the category arguments
- $cat_args = array(
- 'taxonomy' => 'team', // we must specify the custom taxonomy we created as part of the staff CPT
- 'orderby' => 'slug', // this allows us to put a custom slug in to create our own custom order i.e. 01_team-name
- 'order' => 'ASC'
- );
- $cats = get_categories($cat_args); // passing in above parameters
- foreach ($cats as $cat) : // loop through each cat
- $cpt_query_args = array(
- 'post_type' => 'staff',
- 'cat' => $cat->cat_id
- );
- query_posts($cpt_query_args); //create our own custom query based on above arguments
- if (have_posts()) :
- echo '<h2 class="team-title">'.$cat->name.'</h2>';
- while (have_posts()) : the_post(); ?>
- <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <?php the_post_thumbnail('staff-photo'); ?>
- <h3 class="staff-name"><?php the_title(); ?></h3>
- <div class="staff-tenure"><?php echo $_arcpc_tenure; ?></div>
- <?php the_content(); ?>
- </div>
- <?php endwhile; endif; wp_reset_query();
- endforeach;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement