Advertisement
JTWilcox

Untitled

Jun 11th, 2011
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. <?php
  2. $employeeQuery = new WP_Query(array('post_type' => 'professionals', 'meta_key' => 'prof_lastname', 'orderby' => 'meta_value', 'order' => 'ASC')) ?>
  3.     <?php $prevltr = ""; ?> /* holder variable so we know what our current letter is */
  4. <?php if(have_posts()) { while ( $employeeQuery->have_posts() ) { $employeeQuery->the_post(); ?>
  5.     <?php $lastname = get_post_meta($post->ID, 'prof_lastname'); ?> /* get the last name post meta */
  6.     <?php $curltr = strtoupper(mb_substr(trim($lastname,0,1,'UTF-8')))?>
  7.     <?php if($curltr != $prevltr) : ?> /* is our current letter different? */
  8.       <?php echo $curltr; $prevltr = $curltr; ?> /* print out the current letter and update prevltr */
  9.     <?php endif; ?>
  10.  
  11.                   <article class="professional-entry" id="entry-<?php echo $last_char ?>">
  12.  
  13.                       <div><strong><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></strong></div>
  14.                       <div><?php $terms = get_the_terms( $post->ID , 'titles' ); foreach( $terms as $term ) { print $term->name; unset($term); } ?></div>
  15.                       <div><a href="mailto:<?php echo get_post_meta($post->ID, 'prof_email', true); ?>"><?php echo get_post_meta($post->ID, 'prof_email', true); ?></a></div>
  16.  
  17.                   </article>
  18.  
  19.               <?php }} // End the loop. Whew. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement