Advertisement
JTWilcox

Untitled

Jun 13th, 2011
1,706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.26 KB | None | 0 0
  1. <?php $employeeQuery = new WP_Query(array('post_type' => 'professionals', 'meta_key' => 'prof_lastname', 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => '-1')); ?>
  2.             <?php $prevltr = ""; ?>
  3.             <?php if(have_posts()) { while ( $employeeQuery->have_posts() ) { $employeeQuery->the_post(); ?>
  4.                 <?php $lastname = get_post_meta($post->ID, 'prof_lastname', true); ?>
  5.                 <?php $curltr = substr($lastname,0,1); ?>
  6.                 <?php if($curltr != $prevltr) : ?>
  7.                     <a name="section-<?php echo $curltr ?>"></a><br class="clear" /><h2><?php echo $curltr; $prevltr = $curltr; ?></h2>
  8.                 <?php endif; ?>
  9.        
  10.                 <article class="professional-entry" id="entry-<?php echo $last_char ?>">
  11.  
  12.                     <div><strong><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></strong></div>
  13.                     <div><?php $terms = get_the_terms( $post->ID , 'titles' ); foreach( $terms as $term ) { print $term->name; unset($term); } ?></div>
  14.                     <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>
  15.                
  16.                 </article>
  17.        
  18.             <?php }} // End the loop. Whew. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement