crfboston

Untitled

Jun 4th, 2022
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.73 KB | None | 0 0
  1. <ul class="event-list">
  2. <?php
  3. $speaker_posts =  new WP_Query([
  4.        'post_type' => 'speakers',
  5.        'meta_query' => [
  6.            [
  7.                'key' => '2021_speaker',
  8.                'value' => '1',
  9.                'compare' => '=',
  10.            ],
  11.        ],
  12.     ]);
  13.     if ( $speaker_posts->have_posts() ) :
  14.         while ( $speaker_posts->have_posts() ) : $speaker_posts->the_post();
  15.  
  16. // THIS PART IS THE WONKY BIT
  17.  
  18.         if ($speaker_posts) :
  19.             foreach ($speaker_post as $speaker) :
  20.  
  21.             $label = '';
  22.             $mod = get_field('moderator', $speaker->ID);
  23.             $intr = get_field('intro_speaker', $speaker->ID);
  24.  
  25.             if ($mod == true) :
  26.                 $label = ' <span style="color:' . get_field('primary_branding_color', 'options') . '">(moderator)</span>';
  27.             endif;
  28.  
  29.             if ($intr == true) :
  30.                 $label = ' <span style="color: #35a6c4">(introduction)</span>';
  31.             endif;
  32.  
  33.             ?>
  34. // WONKY END
  35.  
  36. <?php
  37.  
  38.   $img_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'headshot' );
  39.    
  40. ?>
  41.  
  42.  
  43.  
  44. <li class="module">
  45. <a class='iframe' href="<?php the_permalink(); ?>">
  46.  
  47.    
  48.    <div class="portrait">
  49.  
  50.     <div class="portrait headshot" title="<?php the_title_attribute(); ?>">
  51.         <?php echo the_post_thumbnail('medium'); ?></div>
  52. </div>
  53.  
  54.  
  55.  
  56.     <div class="inline-content">
  57.  
  58.         <div id="custom-bg" style="background-image: url('<?php echo $image[0]; ?>')"></div>
  59.              <div class="title"><?php the_title_attribute(); ?></div>
  60.              <p class="smalljobtitle"><?php the_field('job_title'); ?><?php echo $label; ?></p>
  61.     </div>
  62. </a>      
  63.  
  64. </li>
  65.     <?php endwhile; ?>
  66.  
  67. <?php endif; ?>
  68. </ul>
Advertisement
Add Comment
Please, Sign In to add comment