From 2ac39db312c883c985c569e3892fd0c1cc8ee76e Mon Sep 17 00:00:00 2001
From: andrewmbacon
Date: Fri, 7 Aug 2015 12:51:23 -0400
Subject: [PATCH] User template completed
---
inc/people-grid.php | 12 ++---
inc/people-table.php | 37 ++++++++--------
single-person.php | 37 ++++++++++++++++
user-people.php | 102 +++++++++++++++++++++++++++----------------
4 files changed, 124 insertions(+), 64 deletions(-)
create mode 100644 single-person.php
diff --git a/inc/people-grid.php b/inc/people-grid.php
index cb66785..5a3f79b 100644
--- a/inc/people-grid.php
+++ b/inc/people-grid.php
@@ -30,15 +30,15 @@
if (in_array('first', $information_to_display) || in_array('middle', $information_to_display) || in_array('last', $information_to_display)){
echo '';
- if (in_array('first', $information_to_display)) {
+ if (in_array('first_name', $information_to_display)) {
the_field('first_name');
echo ' ';
};
- if (in_array('middle', $information_to_display)) {
+ if (in_array('middle_name', $information_to_display)) {
the_field('middle_name');
echo ' ';
};
- if (in_array('last', $information_to_display)) {
+ if (in_array('last_name', $information_to_display)) {
the_field('last_name');
};
echo '
';
@@ -56,7 +56,7 @@
the_field('about');
echo '';
};
- if (in_array('link', $information_to_display)) {
+ if (in_array('file', $information_to_display)) {
echo '';
$file = get_field('file');
//var_dump($thing);
@@ -73,7 +73,7 @@
the_field('phone');
echo '
';
};
- if (in_array('phonealt', $information_to_display)) {
+ if (in_array('phone_(alternate)', $information_to_display)) {
echo '';
the_field('phone_(alternate)');
echo '
';
@@ -83,7 +83,7 @@
the_field('fax');
echo '
';
};
- if (in_array('mail', $information_to_display)) {
+ if (in_array('mailing_address', $information_to_display)) {
echo '';
the_field('mailing_address');
echo '
';
diff --git a/inc/people-table.php b/inc/people-table.php
index 2fb1702..c7b1068 100644
--- a/inc/people-table.php
+++ b/inc/people-table.php
@@ -5,7 +5,7 @@
// how many columns? Based on what they chose to display.
$num_cols = count($information_to_display);
- var_dump($num_cols);
+ //var_dump($num_cols);
?>
@@ -15,13 +15,18 @@
Name';
$nameCell = true;
};
+ } elseif ($value == 'photo') {
+ echo ' | ';
} else {
- echo ''.$value.' | ';
+ //var_dump(get_field_object('field_'.$value));
+ $arr = get_field_object('field_'.$value);
+ $label = $arr['label'];
+ echo ''.$label.' | ';
}
}
?>
@@ -29,17 +34,9 @@
';
+ //var_dump($information_to_display);
+
- function createTextCell($setting, $field){
- global $information_to_display;
- if (in_array($setting, $information_to_display)) {
- echo '';
- the_field($field);
- echo ' | ';
- }
- };
while ( $the_query->have_posts() ) {
$the_query->the_post();
@@ -69,24 +66,24 @@ function createTextCell($setting, $field){
the_post_thumbnail(array('65', '65'));
echo '';
}
- if (in_array('first', $information_to_display) || in_array('middle', $information_to_display) || in_array('last', $information_to_display)){
+ if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){
echo '';
- if (in_array('first', $information_to_display)) {
+ if (in_array('first_name', $information_to_display)) {
the_field('first_name');
echo ' ';
};
- if (in_array('middle', $information_to_display)) {
+ if (in_array('middle_name', $information_to_display)) {
the_field('middle_name');
echo ' ';
};
- if (in_array('last', $information_to_display)) {
+ if (in_array('last_name', $information_to_display)) {
the_field('last_name');
};
echo ' | ';
}
createTextCell('title', 'title');
createTextCell('about', 'about');
- if (in_array('link', $information_to_display)) {
+ if (in_array('file', $information_to_display)) {
echo '';
$file = get_field('file');
echo ''.$file[title].'';
@@ -98,9 +95,9 @@ function createTextCell($setting, $field){
echo ' | ';
};
createTextCell('phone', 'phone');
- createTextCell('phonealt', 'phone_(alternate)');
+ createTextCell('phone_(alternate)', 'phone_(alternate)');
createTextCell('fax', 'fax');
- createTextCell('mail', 'mailing_address');
+ createTextCell('mailing_address', 'mailing_address');
createTextCell('office_location', 'office_location');
createTextCell('office_hours', 'office_hours');
createTextCell('courses', 'courses');
diff --git a/single-person.php b/single-person.php
new file mode 100644
index 0000000..1dd3664
--- /dev/null
+++ b/single-person.php
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/user-people.php b/user-people.php
index e9ea76c..ef3575d 100644
--- a/user-people.php
+++ b/user-people.php
@@ -44,7 +44,16 @@
$specific_tags = get_field( "specific_tags" );
$information_to_display = get_field( "information_to_display" );
- var_dump($specific_people);
+ //var_dump($specific_people);
+
+ function createTextCell($setting, $field){
+ global $information_to_display;
+ if (in_array($setting, $information_to_display)) {
+ echo '';
+ the_field($field);
+ echo ' | ';
+ }
+ };
@@ -83,59 +92,76 @@
}
if ($break_into_groups == 1 ){
- echo 'Break into Groups
';
+ //echo 'Break into Groups
';
// get all the people
$the_query = new WP_Query( $args );
- print_r($the_query->posts);
- echo '
';
- // focusing on jus the people, not the rest of the query.
+ //print_r($the_query->posts);
+ //echo '
';
+ // focusing on just the people, not the rest of the query.
$people = $the_query->posts;
- // look at each person, and see each group used.
+
+ // look at each person, and see each group used, use that to create a list of terms.
+ $groups_in_use = array();
+
foreach($people as $value){
$id = $value->ID;
echo '
';
$terms = get_the_terms($id, 'group');
- var_dump($terms);
+ foreach($terms as $value){
+ //duplicates will overwrite themselves...
+ $slug = $value->slug;
+ $groups_in_use[$slug]= $slug;
+ }
+ //var_dump($groups_in_use);
}
- /**/
- echo '
';
+ // sort the groups in use alphabetically
+ sort($groups_in_use);
- var_dump($the_query);
- /*
- if ( $the_query->have_posts() ) {
- while ( $the_query->have_posts() ) {
- //$the_query->posts;
- //the_title();
+ // for each item in the list of terms, do a new query, but this time we're going to limit it to ONLY items from that one group.
+ echo '
';
+ //var_dump($args);
+ foreach($groups_in_use as $value){
+
+ //echo $value;
+ //echo '
';
+
+ // this sets up the query we'll need, and will overwrite any group queries from the original settings.
+ $tax_query = array();
+ $group_query = array(
+ 'taxonomy' => 'group',
+ 'field' => 'slug',
+ 'terms' => $value
+ );
+ array_push($tax_query, $group_query);
+ $args['tax_query'] = $tax_query;
+
+ // with $arg updated, let's do a new query.
+ echo ''.get_term_by('slug', $value, 'group')->name.'
';
+
+ if ($layout == 'grid') {
+ include('inc/people-grid.php');
}
- };
-
- */
-
- // get all the people (after they've beeen filtered down)
-
- // check those people for groups (don;t want to be listing groups we won;t use)
-
- // Create a list for each group.
+ if ($layout == 'table') {
+ include('inc/people-table.php');
+ }
+
+ echo '
';
+
+ }
+
+ } else {
- // display all people that belong to that group.
+ if ($layout == 'grid') {
+ include('inc/people-grid.php');
+ }
+ if ($layout == 'table') {
+ include('inc/people-table.php');
+ }
}
- /*
- if ($layout == 'grid') {
- include('inc/people-grid.php');
- }
- if ($layout == 'list') {
- include('inc/people-list.php');
- }
- if ($layout == 'table') {
- include('inc/people-table.php');
- }
- */
-
-
?>