Skip to content

Instantly share code, notes, and snippets.

@sunilw
Last active August 24, 2016 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunilw/e8d453f41803c6e9a9938c07e79f08cc to your computer and use it in GitHub Desktop.
Save sunilw/e8d453f41803c6e9a9938c07e79f08cc to your computer and use it in GitHub Desktop.
<?php
$people = new WP_Query( array(
'post_type' => 'person',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'asc',
) );
if ( $people->have_posts() ) : ?>
<div class="intra-nav-wrap" style="margin-top: 1.5em; clear: both; width: 100%; height: 42px;">
<ul class="intra-nav">
<li class="intra-nav-link"><a class="action-link" href="/about/">Profile</a></li>
<li class="intra-nav-link"><a class="action-link active" href="/staff/">Staff</a></li>
<li class="intra-nav-link"><a class="action-link" href="/directions/">Directions</a></li>
</ul>
</div>
<?php $i = 1; ?>
<?php while ( $people->have_posts() ) : $people->the_post(); ?>
<div class="quarter-col <?php if ( $i % 4 == 0 ) : ?>last-col<?php endif; ?>">
<?php
if ( get_post_thumbnail_id() ) {
$person_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
$person_image_src = $person_image[0];
$person_image_alt = get_the_title();
} else {
$person_image_src = '';
$person_image_alt = '';
}
?>
<a class="person-archive" href="<?php the_permalink(); ?>">
<div class="person-archive-meta">
<div class="person-archive-name"><strong><?php the_title(); ?></strong></div>
<div class="person-archive-title"><em><?php echo $cfs->get('person_title'); ?></em></div>
</div>
<img src="<?php echo $person_image_src; ?>" alt="<?php echo $person_image_alt; ?>" class="person-image color" width="<?php echo $person_image[1]; ?>" height="<?php echo $person_image[2]; ?>">
<img src="<?php bloginfo('stylesheet_directory'); ?>/inc/image.php?src=<?php echo $person_image_src; ?>&w=<?php echo $person_image[1]; ?>&h=<?php echo $person_image[2]; ?>&f=2" alt="<?php echo $person_image_alt; ?>" class="person-image gray" width="<?php echo $person_image[1]; ?>" height="<?php echo $person_image[2]; ?>">
</a>
</div>
<?php $i++; endwhile; ?>
<?php
else :
get_template_part('404');
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment