/ page-team.php
page-team.php
 1  <?php get_header(); ?>
 2  
 3  <main>
 4      <img class="h-96 object-cover w-full" style="object-position: center 18%;" src="<?php echo get_the_post_thumbnail_url(); ?>">
 5      <div class="mx-auto max-w-7xl py-8 px-4 xl:px-0 w-full">
 6  
 7          <?php
 8          $kat = array("vorstand", "bibliotheksteam");
 9          foreach ($kat as $k) {
10              $team_query = new WP_Query(array(
11                  "posts_per_page" => -1,
12                  "post_type" => "team",
13                  "orderby" => "menu_order",
14                  "order" => "ASC",
15                  'meta_query'     => array(
16                      'relation' => 'AND',
17                      array(
18                          'key'   => 'kategorie',
19                          'value' => $k,
20                          'compare'    => 'LIKE',
21                      ),
22                  )
23              ));
24          ?>
25  
26              <h2 class="text-xl font-semibold pb-6"><?php echo ucfirst($k); ?></h2>
27              <div class="grid grid-cols-2 md:grid-cols-4 gap-8 pb-6">
28                  <?php while ($team_query->have_posts()) {
29                      $team_query->the_post(); ?>
30  
31                      <div>
32                          <img class="object-cover w-full aspect-square" src="<?php echo get_the_post_thumbnail_url(); ?>">
33                          <div class="p-4 py-2 bg-green-700 text-white">
34                              <p class="text-nowrap overflow-hidden text-ellipsis text-lg font-semibold"><?php the_title(); ?></p>
35                              <p class="text-nowrap text-lg overflow-hidden text-ellipsis"><?php the_field("position") ?></p>
36                          </div>
37                      </div>
38                  <?php } ?>
39  
40                  <?php wp_reset_query();   // Restore global post data stomped by the_post(). 
41                  ?>
42  
43  
44  
45              </div>
46  
47          <?php
48          }
49  
50          the_content(); ?>
51      </div>
52  </main>
53  
54  <?php get_footer(); ?>