public
Created

  • Download Gist
contact.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
<?php
// Employees
$post_args = array(
'post_type' => 'employee',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC'
);
$employees = get_posts( $post_args );
function cmp($a, $b) {
return strcmp($a->post_title, $b->post_title);
}
#uasort($employees, "cmp");
 
// Categories
$cat_args = array(
'type' => 'post',
'taxonomy' => 'kontor',
'orderby' => 'title',
'order' => 'DESC'
);
$categories = get_categories( $cat_args );
?>
 
<div class="clear"></div>
 
<div class="employees">
<ul class="tabs">
<li><a href="#" class="current">Alla</a></li>
<?php foreach( $categories as $category ) : ?>
<li><a href="#"><?php echo $category->name; ?></a></li>
<?php endforeach; ?>
</ul>
 
<div class="panes">
<!-- All -->
<div class="pane">
<?php $count = 0; foreach( $employees as $employee ) : $count++; ?>
<div class="<?php echo ($count % 3 == 0) ? 'one-third-last' : 'one-third'; ?>">
<?php echo get_the_post_thumbnail( $employee->ID, 'full-size' ); ?>
<h2><?php echo get_post_meta( $employee->ID, 'first_name', true ) . ' ' . get_post_meta( $employee->ID, 'last_name', true ); ?></h2>
<?php if( get_post_meta( $employee->ID, 'title', true ) ) : ?>
<h3><?php echo get_post_meta( $employee->ID, 'title', true ); ?></h3>
<?php endif; ?>
<?php if( get_post_meta( $employee->ID, 'email', true ) || get_post_meta( $employee->ID, 'phone', true ) || get_post_meta( $employee->ID, 'cell', true ) ) : ?>
<ul class="list">
<?php if( get_post_meta( $employee->ID, 'email', true ) ) { ?>
<li class="email">
<span>
<a href="mailto:<?php echo get_post_meta( $employee->ID, 'email', true ); ?>">
<?php echo substr( get_post_meta( $employee->ID, 'email', true ), 0, stripos( get_post_meta( $employee->ID, 'email', true), '@' ) ); ?>
</a>
</span>
</li>
<?php } ?>
<?php if( get_post_meta( $employee->ID, 'phone', true ) ) { ?>
<li class="phone">
<span><?php echo get_post_meta( $employee->ID, 'phone', true ); ?></span>
</li>
<?php } ?>
<?php if( get_post_meta( $employee->ID, 'cell', true ) ) { ?>
<li class="cell">
<span><?php echo get_post_meta( $employee->ID, 'cell', true ); ?></span>
</li>
<?php } ?>
</ul>
<?php endif; ?>
</div>
<?php endforeach; wp_reset_postdata(); ?>
</div>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.