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

Commit

Permalink
Add support for multiple titles
Browse files Browse the repository at this point in the history
Each title will be shown a newline
  • Loading branch information
szk11001 committed Dec 2, 2015
1 parent 01aa367 commit 86c4879
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 64 deletions.
60 changes: 31 additions & 29 deletions inc/people-grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) { ?>
<div class="row">
<?php
<?php
$person_count=1;
while ( $the_query->have_posts() ) {
$the_query->the_post();


?>







<div class="col-sm-3 personcount-<?php echo $person_count ?>" id="person-<?php echo get_the_id(); ?>">
<div class="person">
<?php
<?php

echo '<a href="'. get_the_permalink().'" class="person-permalink">';

if (in_array('photo', $information_to_display)) {
echo '<div class="person-image">';
the_post_thumbnail('large');
echo '</div>';
};

if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){
echo '<h4 class="person-name">';
if (in_array('first_name', $information_to_display)) {
Expand All @@ -42,14 +42,17 @@
the_field('last_name');
};
echo '</h4>';
};
};

echo '</a>';

if (in_array('title', $information_to_display)) {
echo '<p class="person-title"><strong>';
the_field('title');
echo '</strong></p>';
echo '<p class="person-title">';
$titlePieces = explode(";", get_field('title'));
foreach( $titlePieces as $t ){
echo ( !empty($t) ? "<strong>{$t}</strong><br>": "" );
}
echo '</p>';
};
if (in_array('about', $information_to_display)) {
echo '<div class="person-about">';
Expand All @@ -63,7 +66,7 @@
echo '<p class="person-file">';
echo '<a href="'.$file[url].'">'.$file[title].'</a>';
echo '</p>';
}
}
};
if (in_array('email', $information_to_display)) {
echo '<p class="person-email">';
Expand Down Expand Up @@ -107,18 +110,17 @@
}; ?>
</div><!-- /person -->
</div> <!-- /col -->
<?php
// check to see if we need to close this row...

<?php
// check to see if we need to close this row...
if ($person_count % 4 == 0){
// if this is the 4th, 8th, 16th, etc person...
echo '</div><!-- /row --><div class="row">';
// if this is the 4th, 8th, 16th, etc person...
echo '</div><!-- /row --><div class="row">';
}
$person_count++;
$person_count++;
} //end of posts?>
</div><!-- last row -->
<?php
<?php
} else {
// no posts found
}; ?>

78 changes: 43 additions & 35 deletions inc/people-table.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
// how many columns? Based on what they chose to display.

// how many columns? Based on what they chose to display.

$num_cols = count($information_to_display);
//var_dump($num_cols);

?>
<table class="table table-striped">
<legend class="sr-only">List of People</legend>
<thead>
<tr>
<?php
<?php
$nameCell = false;
foreach($information_to_display as $value){
if ($value == 'first_name' || $value == 'middle_name' || $value == 'last_name'){
Expand All @@ -33,34 +33,34 @@
</tr>
</thead>
<tbody>
<?php
<?php
//var_dump($information_to_display);



while ( $the_query->have_posts() ) {
$the_query->the_post();
/*
create a row.
For each possible field.
Check to see if it's within the $information_to_display array.

/*
create a row.
For each possible field.
Check to see if it's within the $information_to_display array.
If it is, create a <td>
IF any values are found to match, dump those out.
After all possible fields, close the row.
IF any values are found to match, dump those out.
After all possible fields, close the row.
*/




echo '<tr>';

if (in_array('photo', $information_to_display)) {
echo '<td class="person-image"><a href="'.get_the_permalink().'">';
the_post_thumbnail(array('65', '65'));
Expand All @@ -81,7 +81,15 @@
};
echo '</a></td>';
}
createTextCell('title', 'title');
//createTextCell('title', 'title');
if (in_array('title', $information_to_display)) {
echo '<td class="person-title">';
$titlePieces = explode(";", get_field('title'));
foreach( $titlePieces as $t ){
echo ( !empty($t) ? "<strong>{$t}</strong><br>": "" );
}
echo '</td>';
}
createTextCell('about', 'about');
if (in_array('file', $information_to_display)) {
echo '<td class="person-file">';
Expand All @@ -101,18 +109,18 @@
createTextCell('office_location', 'office_location');
createTextCell('office_hours', 'office_hours');
createTextCell('courses', 'courses');





echo '</tr>';



} //end of posts?>
</tbody>
</table>
<?php

<?php
} else {
// no posts found
}; ?>

0 comments on commit 86c4879

Please sign in to comment.