This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cornerstone/single-person.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
136 lines (130 sloc)
4.6 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Used for displaying the 'person' post type. | |
*/ | |
get_header(); ?> | |
<?php include('inc/sidebar-check.php')?> | |
<div id="page-page"> | |
<?php if (have_posts()) : while ( have_posts() ) : the_post(); ?> | |
<?php include('inc/submenu-check.php') ?> | |
<div class="row"> | |
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>"> | |
<div id="primary" class="content-area subpage"> | |
<main id="main" class="site-main" role="main"> | |
<div class="row"> | |
<div class="col-sm-8"> | |
<h1> | |
<?php | |
the_field('first_name'); | |
echo ' '; | |
if (get_field('middle_name')){ | |
the_field('middle_name'); | |
echo ' '; | |
}; | |
the_field('field_last_name'); | |
?></h1> | |
<?php | |
$titlePieces = explode(";", get_field('title')); | |
foreach( $titlePieces as $t ){ | |
echo ( !empty($t) ? '<p class="text-muted">'.$t.'</p>': '' ); | |
} | |
$departmentPieces = explode(";", get_field('department')); | |
foreach( $departmentPieces as $d ){ | |
echo ( !empty($d) ? '<p class="text-muted">'.$d.'</p>': '' ); | |
} | |
?> | |
<hr/> | |
<?php the_field('about'); ?> | |
</div> | |
<div class="col-sm-4"> | |
<?php if(get_the_post_thumbnail()){ | |
echo '<div class="person-thumbnail">'; | |
the_post_thumbnail(); | |
echo '</div>'; | |
};?> | |
<div> | |
<table class="table"> | |
<legend class="sr-only">Contact Information</legend> | |
<?php | |
/* | |
function displayField($field){ | |
if (get_field($field)){ | |
$field_key = 'field_'.$field; | |
$field_obj = get_field_object($field_key); | |
$field_value = $field_obj['value']; | |
$field_label = $field_obj['label']; | |
echo '<h5>'.$field_label.'</h5>'; | |
echo '<p class="person-'.$field.'">'; | |
if ($field == 'email'){ | |
echo '<a href="mailto:'.$field_value.'">'; | |
the_field($field); | |
echo '</a>'; | |
} else if ($field == 'file'){ | |
$file = get_field($field); | |
$url= $file['url']; | |
echo '<a class="btn btn-default" href="'.$url.'"><span class="glyphicon glyphicon-save-file"></span> '; | |
echo $file['title']; | |
echo '</a>'; | |
} else { | |
the_field($field); | |
} | |
echo '</p><hr/>'; | |
} | |
} | |
*/ | |
function displayField($field){ | |
if (get_field($field)){ | |
$field_key = 'field_'.$field; | |
$field_obj = get_field_object($field_key); | |
$field_value = $field_obj['value']; | |
$field_label = $field_obj['label']; | |
echo '<tr>'; | |
if ($field == 'file'){ | |
echo '<th>'.get_field('filelabel').'</th>'; | |
} else { | |
echo '<th>'.$field_label.'</th>'; | |
} | |
echo '<td class="person-'.$field.'">'; | |
if ($field == 'email'){ | |
echo '<a href="mailto:'.$field_value.'">'; | |
the_field($field); | |
echo '</a>'; | |
} else if ($field == 'file'){ | |
$file = get_field($field); | |
$url= $file['url']; | |
echo '<a href="'.$url.'"><span class="glyphicon glyphicon-save-file"></span> '; | |
echo $file['title']; | |
echo '</a>'; | |
} else if ($field == 'mailing_address'){ | |
echo str_replace(';','<br>',get_field('mailing_address')); | |
} else { | |
the_field($field); | |
} | |
echo '</td></tr>'; | |
} | |
} | |
displayField('email'); | |
displayField('phone'); | |
displayField('phone_(alternate)'); | |
displayField('fax'); | |
displayField('file'); | |
displayField('mailing_address'); | |
displayField('office_location'); | |
displayField('campus'); | |
displayField('office_hours'); | |
displayField('courses'); | |
displayField('url'); | |
?> | |
</table> | |
</div> | |
</div> | |
</div> | |
</main> | |
</div> | |
</div> | |
<?php include('inc/sidebar-if-active.php')?> | |
</div> | |
<?php include('inc/submenu-closing-tags.php')?> | |
<?php endwhile; endif; // end of the loop. ?> | |
</div> | |
<?php get_footer(); ?> |