cwulff

ACF - Shortcode - Team Loop

Jun 20th, 2014
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.83 KB | None | 0 0
  1. <?php
  2.  
  3. function teamlist_staff_shortcode($atts, $content = null) {
  4.     if (get_field('uucef_teammembers')) :
  5.        
  6.   $string = '';
  7.  
  8.     echo '<div class="repeater-list">';
  9.  
  10.     while (has_sub_field('uucef_teammembers') && get_sub_field('team_type') == "staff") :
  11.  
  12.     $string .= '<div class="item"><h3>' . get_sub_field('team_name') . '<span class="subtitle">' . get_sub_field('team_title') . '</span></h3>' . get_sub_field('team_bio') .'</div>';
  13.    
  14.     endwhile;
  15.    
  16.     echo '</div>'; //END .repeater-list
  17.  
  18.     return $string;
  19.  
  20.     endif;
  21. }
  22.  
  23. add_shortcode('teamlist-staff', 'teamlist_staff_shortcode');
  24.  
  25.  
  26.  
  27.  
  28.  
  29. // INVESTMENT COMMITTEE SHORTCODE
  30.  
  31. function teamlist_investment_shortcode($atts, $content = null) {
  32.     if (get_field('uucef_teammembers')) :
  33.        
  34.   $string = '';
  35.  
  36.     echo '<div class="repeater-list">';
  37.  
  38.     while (has_sub_field('uucef_teammembers') && get_sub_field('team_type') == "investment") :
  39.  
  40.     $string .= '<div class="item"><h3>' . get_sub_field('team_name') . '<span class="subtitle">' . get_sub_field('team_title') . '</span></h3>' . get_sub_field('team_bio') .'</div>';
  41.    
  42.     endwhile;
  43.    
  44.     echo '</div>'; //END .repeater-list
  45.  
  46.     return $string;
  47.  
  48.     endif;
  49. }
  50.  
  51. add_shortcode('teamlist-investment', 'teamlist_investment_shortcode');
  52.  
  53.  
  54.  
  55. // SRI COMMITTEE SHORTCODE
  56.  
  57. function teamlist_sri_shortcode($atts, $content = null) {
  58.     if (get_field('uucef_teammembers')) :
  59.        
  60.   $string = '';
  61.  
  62.     echo '<div class="repeater-list">';
  63.  
  64.     while (has_sub_field('uucef_teammembers') && get_sub_field('team_type') == "sri") :
  65.  
  66.     $string .= '<div class="item"><h3>' . get_sub_field('team_name') . '<span class="subtitle">' . get_sub_field('team_title') . '</span></h3>' . get_sub_field('team_bio') .'</div>';
  67.    
  68.     endwhile;
  69.    
  70.     echo '</div>'; //END .repeater-list
  71.  
  72.     return $string;
  73.  
  74.     endif;
  75. }
  76.  
  77. add_shortcode('teamlist-sri', 'teamlist_sri_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment