diff --git a/footer.php b/footer.php index 6bbcc78..b566259 100644 --- a/footer.php +++ b/footer.php @@ -1,81 +1,95 @@ - - - - -
- - -
- - - - - - + + + + +
+ + +
+ + + + + + diff --git a/header.php b/header.php index 877e34f..b56d96b 100644 --- a/header.php +++ b/header.php @@ -1,81 +1,95 @@ - section and everything up till
- * - */ - include 'inc/vars.php'; -?> - -> - - - - - -<?php wp_title( '|', true, 'right' ); ?> - - - - - -> - - - - - - -
- - -
+ section and everything up till
+ * + */ +if ( apply_filters( 'load_custom_header', false ) ) { + $custom_header = apply_filters( 'get_custom_header', '' ); + + if ( '' != $custom_header ) { + // Get the header that we just received + // and call the native 'get_header' function + // as usual + load_template( $custom_header ); + + // By calling 'return' we are skipping + // parsing this template any further + return; + } +} + include 'inc/vars.php'; +?> + +> + + + + + +<?php wp_title( '|', true, 'right' ); ?> + + + + + +> + + + + + + +
+ + +
\ No newline at end of file diff --git a/inc/people-grid.php b/inc/people-grid.php index 6093e50..72301e9 100644 --- a/inc/people-grid.php +++ b/inc/people-grid.php @@ -1,126 +1,127 @@ -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)) { - the_field('first_name'); - echo ' '; - }; - if (in_array('middle_name', $information_to_display)) { - the_field('middle_name'); - echo ' '; - }; - if (in_array('last_name', $information_to_display)) { - the_field('last_name'); - }; - echo '

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

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

'; - }; - if (in_array('about', $information_to_display)) { - echo '
'; - the_field('about'); - echo '
'; - }; - if (in_array('file', $information_to_display)) { - $file = get_field('file'); - $urlLength = strlen($file); - if ($urlLength > 0){ - echo '

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

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

'; - echo ''.get_field('email').''; - echo '

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

'; - the_field('phone'); - echo '

'; - }; - if (in_array('phone_(alternate)', $information_to_display)) { - echo '

'; - the_field('phone_(alternate)'); - echo '

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

'; - the_field('fax'); - echo '

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

'; - the_field('mailing_address'); - echo '

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

'; - the_field('office_location'); - echo '

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

'; - the_field('office_hours'); - echo '

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

'; - the_field('courses'); - echo '

'; - }; ?> -
-
- -
'; - } - $person_count++; - } //end of posts?> -
- +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)) { + the_field('first_name'); + echo ' '; + }; + if (in_array('middle_name', $information_to_display)) { + the_field('middle_name'); + echo ' '; + }; + if (in_array('last_name', $information_to_display)) { + the_field('last_name'); + }; + echo '

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

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

'; + }; + if (in_array('about', $information_to_display)) { + echo '
'; + the_field('about'); + echo '
'; + }; + if (in_array('file', $information_to_display)) { + $file = get_field('file'); + $urlLength = strlen($file); + if ($urlLength > 0){ + echo '

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

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

'; + echo ''.get_field('email').''; + echo '

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

'; + the_field('phone'); + echo '

'; + }; + if (in_array('phone_(alternate)', $information_to_display)) { + echo '

'; + the_field('phone_(alternate)'); + echo '

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

'; + the_field('fax'); + echo '

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

'; + echo str_replace(';','
',get_field('mailing_address')); + echo '

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

'; + the_field('office_location'); + echo '

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

'; + the_field('office_hours'); + echo '

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

'; + the_field('courses'); + echo '

'; + }; ?> +
+
+ +
'; + } + $person_count++; + } //end of posts?> +
+ + \ No newline at end of file diff --git a/inc/people-table.php b/inc/people-table.php index 2aab3c2..06d84df 100644 --- a/inc/people-table.php +++ b/inc/people-table.php @@ -1,126 +1,131 @@ -have_posts() ) { - - // how many columns? Based on what they chose to display. - - $num_cols = count($information_to_display); - //var_dump($num_cols); - - ?> - - List of People - - - Name'; - $nameCell = true; - }; - } elseif ($value == 'photo') { - echo ''; - } else { - //var_dump(get_field_object('field_'.$value)); - $arr = get_field_object('field_'.$value); - $label = $arr['label']; - echo ''; - } - } - ?> - - - - 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. - - If it is, create a '; - - if (in_array('photo', $information_to_display)) { - echo ''; - } - if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){ - echo ''; - } - //createTextCell('title', 'title'); - if (in_array('title', $information_to_display)) { - echo ''; - } - createTextCell('about', 'about'); - if (in_array('file', $information_to_display)) { - echo ''; - }; - if (in_array('email', $information_to_display)) { - echo ''; - }; - createTextCell('phone', 'phone'); - createTextCell('phone_(alternate)', 'phone_(alternate)'); - createTextCell('fax', 'fax'); - createTextCell('mailing_address', 'mailing_address'); - createTextCell('office_location', 'office_location'); - createTextCell('office_hours', 'office_hours'); - createTextCell('courses', 'courses'); - - - - echo ''; - - - - } //end of posts?> - -
 '.$label.'
- - IF any values are found to match, dump those out. - - After all possible fields, close the row. - - */ - - - - - echo '
'; - the_post_thumbnail(array('65', '65')); - echo ''; - if (in_array('first_name', $information_to_display)) { - the_field('first_name'); - echo ' '; - }; - if (in_array('middle_name', $information_to_display)) { - the_field('middle_name'); - echo ' '; - }; - if (in_array('last_name', $information_to_display)) { - the_field('last_name'); - }; - echo ''; - $titlePieces = explode(";", get_field('title')); - foreach( $titlePieces as $t ){ - echo ( !empty($t) ? "{$t}
": "" ); - } - echo '
'; - $file = get_field('file'); - echo ''.$file[title].''; - echo ''; - echo ''.get_field('email').''; - echo '
- - have_posts() ) { + + // how many columns? Based on what they chose to display. + + $num_cols = count($information_to_display); + //var_dump($num_cols); + + ?> + + List of People + + + Name'; + $nameCell = true; + }; + } elseif ($value == 'photo') { + echo ''; + } else { + //var_dump(get_field_object('field_'.$value)); + $arr = get_field_object('field_'.$value); + $label = $arr['label']; + echo ''; + } + } + ?> + + + + 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. + + If it is, create a '; + + if (in_array('photo', $information_to_display)) { + echo ''; + } + if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){ + echo ''; + } + //createTextCell('title', 'title'); + if (in_array('title', $information_to_display)) { + echo ''; + } + createTextCell('about', 'about'); + if (in_array('file', $information_to_display)) { + echo ''; + }; + if (in_array('email', $information_to_display)) { + echo ''; + }; + createTextCell('phone', 'phone'); + createTextCell('phone_(alternate)', 'phone_(alternate)'); + createTextCell('fax', 'fax'); + //createTextCell('mailing_address', 'mailing_address'); + if (in_array('mailing_address', $information_to_display)) { + echo ''; + } + createTextCell('office_location', 'office_location'); + createTextCell('office_hours', 'office_hours'); + createTextCell('courses', 'courses'); + + + + echo ''; + + + + } //end of posts?> + +
 '.$label.'
+ + IF any values are found to match, dump those out. + + After all possible fields, close the row. + + */ + + + + + echo '
'; + the_post_thumbnail(array('65', '65')); + echo ''; + if (in_array('first_name', $information_to_display)) { + the_field('first_name'); + echo ' '; + }; + if (in_array('middle_name', $information_to_display)) { + the_field('middle_name'); + echo ' '; + }; + if (in_array('last_name', $information_to_display)) { + the_field('last_name'); + }; + echo ''; + $titlePieces = explode(";", get_field('title')); + foreach( $titlePieces as $t ){ + echo ( !empty($t) ? "{$t}
": "" ); + } + echo '
'; + $file = get_field('file'); + echo ''.$file[title].''; + echo ''; + echo ''.get_field('email').''; + echo ''; + echo str_replace(';','
',get_field('mailing_address')); + echo '
+ + \ No newline at end of file diff --git a/single-person.php b/single-person.php index aefe8cc..717370e 100644 --- a/single-person.php +++ b/single-person.php @@ -1,33 +1,125 @@ - - -
- - -
-
-
-
-
- 0){ - include('inc/person-with-about.php'); - } else { - include('inc/person-no-about.php'); - } - ?> -
-
-
-
- -
- - -
- + + +
+ + +
+
+
+
+
+
+

+

+ + '.$t.'

': '' ); + } + ?> +
+ +
+
+ '; + the_post_thumbnail(); + echo '
'; + };?> +
+ + Contact Information + '.$field_label.''; + echo '

'; + if ($field == 'email'){ + echo ''; + the_field($field); + echo ''; + } else if ($field == 'file'){ + $file = get_field($field); + $url= $file['url']; + echo ' '; + echo $file['title']; + echo ''; + } else { + the_field($field); + } + echo '


'; + } + } + */ + 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 ''; + echo ''; + } + } + displayField('email'); + displayField('phone'); + displayField('phone_(alternate)'); + displayField('fax'); + displayField('file'); + displayField('mailing_address'); + displayField('office_location'); + displayField('office_hours'); + displayField('courses'); + ?> +
'.$field_label.''; + if ($field == 'email'){ + echo ''; + the_field($field); + echo ''; + } else if ($field == 'file'){ + $file = get_field($field); + $url= $file['url']; + echo ' '; + echo $file['title']; + echo ''; + } else if ($field == 'mailing_address'){ + echo str_replace(';','
',get_field('mailing_address')); + } else { + the_field($field); + } + echo '
+
+
+
+ + + +
+
+ +
+ + +
+ diff --git a/user-people.php b/user-people.php index 81a8e7f..5a33bd0 100644 --- a/user-people.php +++ b/user-people.php @@ -1,8 +1,8 @@ @@ -24,9 +24,9 @@ ', '' ); ?>
- -1, @@ -34,12 +34,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" ); @@ -47,47 +47,57 @@ $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)) { - echo ''; + echo ''; the_field($field); echo ''; } }; - - - + + 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}" ); + $orderGroupA = $array_orderGroupA['group_order']; + + $groupB = get_term_by('slug', $b, 'group')->term_id; + $array_orderGroupB = get_option( "taxonomy_{$groupB}" ); + $orderGroupB = $array_orderGroupB['group_order']; + + $r = strnatcasecmp( $orderGroupA, $orderGroupB ); + if( $r === 0 ){ + $r = strnatcasecmp( $a, $b ); + } + return $r; + } + 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); + array_push($post__in, $value->ID); } $args[post__in]= $post__in; } - + // do we need a tax query? - if ($specific_groups != false || $specific_tags != false){ - - $tax_query = array(); - $isTagSet = false; - + if ($specific_groups != false || $specific_tags != false){ + + $tax_query = array(); + 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', @@ -96,23 +106,22 @@ function createTextCell($setting, $field){ 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 = $value->ID; $terms = get_the_terms($id, 'group'); if (is_array($terms)){ foreach($terms as $key => $value){ @@ -120,16 +129,17 @@ function createTextCell($setting, $field){ $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. + //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. 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', @@ -137,36 +147,33 @@ function createTextCell($setting, $field){ 'terms' => $value ); array_push($tax_query, $group_query); - 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'); } - + } ?> - - + +
@@ -195,4 +202,4 @@ function adjustImages(){ adjustImages(); }); - \ No newline at end of file +