';
}
diff --git a/user-people.php b/user-people.php
index 9fd6e64..fdb92fb 100644
--- a/user-people.php
+++ b/user-people.php
@@ -1,8 +1,8 @@
@@ -24,10 +24,10 @@
', '' ); ?>
- -1,
@@ -35,12 +35,12 @@
'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" );
@@ -48,7 +48,7 @@
$specific_groups = get_field( "specific_groups" );
$specific_tags = get_field( "specific_tags" );
$information_to_display = get_field( "information_to_display" );
-
+
function createTextCell($setting, $field){
global $information_to_display;
if (in_array($setting, $information_to_display)) {
@@ -57,24 +57,24 @@ function createTextCell($setting, $field){
echo '';
}
};
-
- function sort_group_by_order( $a, $b ){
+
+ function sort_group_by_order( $a, $b ){
// Getting the order for groups $a and $b
$groupA = get_term_by('slug', $a, 'group')->term_id;
- $array_orderGroupA = get_option( "taxonomy_{$groupA}" );
+ $array_orderGroupA = get_option( "taxonomy_{$groupA}" );
$orderGroupA = $array_orderGroupA['group_order'];
-
+
$groupB = get_term_by('slug', $b, 'group')->term_id;
- $array_orderGroupB = get_option( "taxonomy_{$groupB}" );
+ $array_orderGroupB = get_option( "taxonomy_{$groupB}" );
$orderGroupB = $array_orderGroupB['group_order'];
-
+
$r = strnatcasecmp( $orderGroupA, $orderGroupB );
if( $r === 0 ){
$r = strnatcasecmp( $a, $b );
}
- return $r;
+ return $r;
}
-
+
if ($specific_people){
global $specific_people;
global $args;
@@ -85,20 +85,20 @@ function sort_group_by_order( $a, $b ){
}
$args[post__in]= $post__in;
}
-
+
// do we need a tax query?
- if ($specific_groups != false || $specific_tags != false){
-
+ if ($specific_groups != false || $specific_tags != false){
+
$tax_query = array();
- $isTagSet = false;
-
+ $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;
@@ -110,20 +110,26 @@ function sort_group_by_order( $a, $b ){
array_push($tax_query, $tag_query);
}
$args[tax_query] = $tax_query;
-
+
+ }
+
+ $persons_per_row = get_field("persons_per_row"); // default is 4
+ if ( ! $persons_per_row ){
+ $persons_per_row = 4;
}
+
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;
@@ -134,7 +140,7 @@ function sort_group_by_order( $a, $b ){
$slug = $value->slug;
$groups_in_use[$slug]= $slug;
}
- };
+ };
}
if(!empty($specific_groups) && is_array($specific_groups)){
$groups_in_use = array();
@@ -147,10 +153,12 @@ function sort_group_by_order( $a, $b ){
//sort($groups_in_use);
usort($groups_in_use, 'sort_group_by_order' );
- // 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',
@@ -161,34 +169,34 @@ function sort_group_by_order( $a, $b ){
if( $isTagSet != false ){
array_push($tax_query, $tag_query);
}
- $args['tax_query'] = $tax_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');
}
-
+
}
}
?>
-
-
+
+