Advertisement
SoulExpression

archive-team_members.php

Jul 19th, 2021 (edited)
3,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.52 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Team Members Post Template
  4.  *
  5.  * @package WordPress
  6.  * @subpackage Visual Composer Starter
  7.  * @since Visual Composer Starter 1.0
  8.  */
  9.  
  10. get_header(); ?>
  11.  
  12. <div class="container">
  13.     <div class="content-wrapper">
  14.         <div class="row">
  15.             <div class="col-md-12">
  16.                 <div class="main-content">
  17.                     <div class="archive">
  18.                         <div class="team-grid-wrapper">
  19.                             <?php
  20.                                 $queried_object = get_queried_object();
  21.                                 $taxonomy = $queried_object->taxonomy;
  22.                                 $term_id = $queried_object->term_id;
  23.  
  24.                                 $term_sort_id = get_field( 'team_category_sort_order', $taxonomy . '_' . $term_id );
  25.  
  26.                                 $args = array(
  27.                                     'taxonomy'      => 'team_category',
  28.                                     'orderby'       => 'meta_value_num',
  29.                                     'meta_compare'  => 'NUMERIC',
  30.                                     'order'         => 'DESC',
  31.                                     'meta_key'      => 'team_category_sort_order'
  32.                                 );
  33.  
  34.                                 $_terms = get_terms( $args );
  35.                                
  36.  
  37.                                 foreach ($_terms as $term) :
  38.  
  39.                                     $term_slug = $term->slug;
  40.                                     $_posts = new WP_Query( array(
  41.                                                 'post_type'         => 'team_members',
  42.                                                 'order'             => 'ASC',
  43.                                                 'orderby'           => 'menu_order',
  44.                                                 'tax_query' => array(
  45.                                                     array(
  46.                                                         'taxonomy'  => 'team_category',
  47.                                                         'field'     => 'slug',
  48.                                                         'terms'     => $term_slug,
  49.                                                     ),
  50.                                                 ),
  51.                                             ));
  52.  
  53.                                     if( $_posts->have_posts() ) :
  54.                                         ?>
  55.                                         <div class="teamcat <?php if( $teamcounter % 2 == 0 ) : echo 'bluebg-row'; else : endif; ?> teamcategory-<?php echo $term->slug; ?>">
  56.                                             <h2 class="teamcat-heading"><?php echo $term->name ?> <span style="border:  1px solid black"><?php if($term_sort_id) {echo $term_sort_id;}else{echo 'empty';} ?></span></h2>
  57.                                             <br>
  58.                                             <div class="teamcat-items teamcategory-<?php echo $term->slug; ?>-items">
  59.                                                 <?php while ( $_posts->have_posts() ) : $_posts->the_post(); ?>
  60.                                                 <?php
  61.                                                     $linkorno = get_field('team_bio');
  62.                                                     $linkurl = get_permalink();
  63.                                                 ?>
  64.                                                 <div class="team-member-wrapper">
  65.                                                     <div class="team-member-image-wrapper">
  66.                                                         <?php the_post_thumbnail( 'full' ); ?>
  67.                                                     </div>
  68.                                                     <div class="team-member-content-wrapper">
  69.                                                         <h3 class="team-member-name">
  70.                                                             <?php if( $linkorno ): ?><a href="<?php the_permalink(); ?>"><?php endif; ?>
  71.                                                             <?php the_title(); ?>
  72.                                                             <?php if( $linkorno ): ?></a><?php endif; ?>
  73.                                                         </h3>
  74.                                                         <span><?php the_field('team_title'); ?></span>
  75.                                                         <span><?php the_field('team_phone_number'); ?></span>
  76.                                                         <span><?php the_field('team_email'); ?></span>
  77.                                                     </div>
  78.                                                 </div>
  79.                                                 <?php endwhile; ?>
  80.                                             </div>
  81.                                         </div>
  82.                                     <?php
  83.                                     endif;
  84.                                     wp_reset_postdata();
  85.  
  86.                                 endforeach;
  87.                                 ?>
  88.  
  89.                         </div><!-- team grid wrapper -->
  90.                     </div><!--archive -->
  91.                 </div><!-- main-content -->
  92.             </div><!-- col-md-12 -->
  93.         </div> <!-- row -->
  94.  
  95.     </div><!-- content-wrapper -->
  96.  
  97. </div><!-- container -->
  98. <?php
  99. get_footer();
  100. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement