From 1845f0542a311ddb06725c57bed293dfe1c226e8 Mon Sep 17 00:00:00 2001 From: Joshua Roy Date: Mon, 7 Dec 2015 11:31:10 -0500 Subject: [PATCH] Merge conflict --- inc/people-grid.php | 60 ++++++++++++++------------- inc/people-table.php | 78 +++++++++++++++++++---------------- user-people.php | 97 ++++++++++++++++++++++++-------------------- 3 files changed, 127 insertions(+), 108 deletions(-) diff --git a/inc/people-grid.php b/inc/people-grid.php index 23ce530..6093e50 100644 --- a/inc/people-grid.php +++ b/inc/people-grid.php @@ -2,32 +2,32 @@ $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { ?>
- have_posts() ) { $the_query->the_post(); - - + + ?> - - - - - - - + + + + + + +
- '; - + if (in_array('photo', $information_to_display)) { echo '
'; the_post_thumbnail('large'); echo '
'; }; - + 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_name', $information_to_display)) { @@ -42,14 +42,17 @@ if ( $the_query->have_posts() ) { ?> the_field('last_name'); }; echo '

'; - }; - + }; + echo ''; - + if (in_array('title', $information_to_display)) { - echo '

'; - the_field('title'); - echo '

'; + echo '

'; + $titlePieces = explode(";", get_field('title')); + foreach( $titlePieces as $t ){ + echo ( !empty($t) ? "{$t}
": "" ); + } + echo '

'; }; if (in_array('about', $information_to_display)) { echo '
'; @@ -63,7 +66,7 @@ if ( $the_query->have_posts() ) { ?> echo '

'; echo ''.$file[title].''; echo '

'; - } + } }; if (in_array('email', $information_to_display)) { echo '

'; @@ -107,18 +110,17 @@ if ( $the_query->have_posts() ) { ?> }; ?>

- -
'; + // if this is the 4th, 8th, 16th, etc person... + echo '
'; } - $person_count++; + $person_count++; } //end of posts?>
- - \ No newline at end of file diff --git a/inc/people-table.php b/inc/people-table.php index c7b1068..2aab3c2 100644 --- a/inc/people-table.php +++ b/inc/people-table.php @@ -1,18 +1,18 @@ 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); - + ?> List of People - have_posts() ) { - 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 '; - + if (in_array('photo', $information_to_display)) { echo ''; } - createTextCell('title', 'title'); + //createTextCell('title', 'title'); + if (in_array('title', $information_to_display)) { + echo ''; + } createTextCell('about', 'about'); if (in_array('file', $information_to_display)) { echo ''; - - - + + + } //end of posts?>
- - 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 '
'; the_post_thumbnail(array('65', '65')); @@ -81,7 +81,15 @@ if ( $the_query->have_posts() ) { }; echo ''; + $titlePieces = explode(";", get_field('title')); + foreach( $titlePieces as $t ){ + echo ( !empty($t) ? "{$t}
": "" ); + } + echo '
'; @@ -101,18 +109,18 @@ if ( $the_query->have_posts() ) { createTextCell('office_location', 'office_location'); createTextCell('office_hours', 'office_hours'); createTextCell('courses', 'courses'); - - + + echo '
- - \ No newline at end of file diff --git a/user-people.php b/user-people.php index d37532e..81a8e7f 100644 --- a/user-people.php +++ b/user-people.php @@ -1,8 +1,8 @@ @@ -24,9 +24,9 @@ get_header(); ?> ', '' ); ?>
- -1, @@ -34,12 +34,12 @@ get_header(); ?> 'meta_key' => 'last_name', 'orderby' => 'menu_order meta_value title', 'order' => 'ASC', - ); - - - + ); + + + // Settings - + $layout = get_field( "layout" ); $people_to_display = get_field( "people_to_display" ); $break_into_groups = get_field( "break_into_groups" ); @@ -47,7 +47,9 @@ get_header(); ?> $specific_groups = get_field( "specific_groups" ); $specific_tags = get_field( "specific_tags" ); $information_to_display = get_field( "information_to_display" ); - + + //var_dump($specific_people); + function createTextCell($setting, $field){ global $information_to_display; if (in_array($setting, $information_to_display)) { @@ -56,33 +58,36 @@ get_header(); ?> echo ''; } }; - - - + + + if ($specific_people){ global $specific_people; global $args; $post__in = array(); foreach($specific_people as &$value){ - array_push($post__in, $value->ID); + //array_push($post__in, $value->ID); + array_push($post__in, $value); } $args[post__in]= $post__in; } - + // do we need a tax query? - if ($specific_groups != false || $specific_tags != false){ - - $tax_query = array(); - + if ($specific_groups != false || $specific_tags != false){ + + $tax_query = array(); + $isTagSet = false; + if ($specific_groups != false) { $group_query = array( 'taxonomy' => 'group', 'field' => 'term_id', 'terms' => $specific_groups ); - array_push($tax_query, $group_query); + array_push($tax_query, $group_query); } if ($specific_tags != false) { + $isTagSet = true; $tag_query = array( 'taxonomy' => 'persontag', 'field' => 'term_id', @@ -91,22 +96,23 @@ get_header(); ?> array_push($tax_query, $tag_query); } $args[tax_query] = $tax_query; - + } if ($break_into_groups == 1 ){ //echo '

Break into Groups

'; - + // get all the people $the_query = new WP_Query( $args ); - - // focusing on just the people, not the rest of the query. + + // focusing on just the people, not the rest of the query. $people = $the_query->posts; - - // look at each person, and see each group used, use that to create a list of terms. + + // 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; + //$id = $value->ID; + $id = $value; $terms = get_the_terms($id, 'group'); if (is_array($terms)){ foreach($terms as $key => $value){ @@ -114,16 +120,16 @@ get_header(); ?> $slug = $value->slug; $groups_in_use[$slug]= $slug; } - }; + }; } - + // sort the groups in use alphabetically sort($groups_in_use); - - // 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. + + // 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. foreach($groups_in_use as $value){ - - // this sets up the query we'll need, and will overwrite any group queries from the original settings. + + // 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', @@ -131,33 +137,36 @@ get_header(); ?> 'terms' => $value ); array_push($tax_query, $group_query); - $args['tax_query'] = $tax_query; + if( $isTagSet != false ){ + array_push($tax_query, $tag_query); + } + $args['tax_query'] = $tax_query; - // with $arg updated, let's do a new 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'); } if ($layout == 'table') { include('inc/people-table.php'); } - + } } else { - + if ($layout == 'grid') { include('inc/people-grid.php'); } if ($layout == 'table') { include('inc/people-table.php'); } - + } ?> - - + +
@@ -186,4 +195,4 @@ jQuery(window).load(function() { adjustImages(); }); - + \ No newline at end of file