Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing out of sync issue
  • Loading branch information
jmr06005 committed Dec 17, 2015
1 parent c607e65 commit 69e139d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 192 deletions.
48 changes: 48 additions & 0 deletions inc/person-info.php
@@ -0,0 +1,48 @@
<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 '<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>
46 changes: 5 additions & 41 deletions inc/person-no-about.php
Expand Up @@ -21,46 +21,10 @@
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>': '' );
}
?>
<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 '<tr><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('office_hours');
displayField('courses');
?>
</table>
<?php include('person-info.php'); ?>
</div>
46 changes: 5 additions & 41 deletions inc/person-with-about.php
Expand Up @@ -14,6 +14,10 @@
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'); ?>
Expand All @@ -25,46 +29,6 @@
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 '<tr><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('office_hours');
displayField('courses');
?>
</table>
<?php include('person-info.php'); ?>
</div>
</div>
117 changes: 7 additions & 110 deletions single-person.php
Expand Up @@ -13,118 +13,15 @@ get_header(); ?>
<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>': '' );
<?php
$about = get_field('about');
if (strlen($about) > 0){
include('inc/person-with-about.php');
} else {
include('inc/person-no-about.php');
}
$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>
Expand Down

0 comments on commit 69e139d

Please sign in to comment.