diff --git a/403.php b/403.php new file mode 100644 index 0000000..1ee77dc --- /dev/null +++ b/403.php @@ -0,0 +1,53 @@ + +
+
+
+
+
+
+
+
+ +
+

+
+ +
+
+
    + '404', + 'container' => false, + 'items_wrap' => '%3$s', + 'depth' => 1, + 'fallback_cb' => false + ); + wp_nav_menu( $defaults ); + } + ?> +
+
+
+
+
+ Photo of a puppy. +
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/404.php b/404.php index c9edda5..3565ba9 100755 --- a/404.php +++ b/404.php @@ -5,13 +5,6 @@ * @package cornerstone */ get_header(); ?> -ID, 'uc-private', true); -if($private == 'admins' || $private == 'users' || $private == 'list' || $private == 'netids'){ - $private = true; - echo 'This is a private page'; -} -?>
diff --git a/functions.php b/functions.php index c1503a5..f56392c 100644 --- a/functions.php +++ b/functions.php @@ -115,24 +115,24 @@ function cs_widgets_init() { */ require get_template_directory() . '/inc/customizer.php'; -/** +/** * New nav walkers */ require get_template_directory() . '/inc/nav-walker.php'; require get_template_directory() . '/inc/nav-drop-multi-walker.php'; require get_template_directory() . '/inc/nav-tabs-walker.php'; -/** +/** * Bootstrap the comment form. */ require get_template_directory() . '/inc/bootstrap-forms.php'; -/** +/** * Custom site settings */ require get_template_directory() . '/inc/settings.php'; -/** +/** * Bootstrap Whitelist */ require get_template_directory() . '/inc/bootstrap-whitelist.php'; @@ -175,13 +175,13 @@ function hale_main_nav_fallback($args) { } else { echo ''; } - + } $attributes = (!empty($args['menu_class'])?' class="'.$args['menu_class'].'"':''); $attributes .= (!empty($args['menu_id'])?' id="'.$args['menu_id'].'"':''); echo ''; if($data->length > 0) { - foreach($data as $item) { + foreach($data as $item) { echo $item->ownerDocument->saveXML($item);//saveHTML wouldn't accept it as paramater. } } @@ -193,9 +193,9 @@ function hale_main_nav_fallback($args) { } else { echo '
'; } - + } - } + } return; } @@ -247,4 +247,21 @@ function ssi_add_widget_class( $classes ) { return $classes; } +function uc_redirect_403() { + if( get_query_var( 'is_403' ) == true ){ + global $wp_query; + + status_header(403); + $wp_query->is_404=false; + + add_filter( 'wp_title', function( $title='', $sep='' ){ + return "Forbidden | ".get_bloginfo('name'); + }); + get_template_part('403'); + exit; + } +} + +add_action( 'template_redirect', 'uc_redirect_403' ); + ?> \ No newline at end of file diff --git a/inc/people-grid.php b/inc/people-grid.php index 5163dd0..2b37adc 100644 --- a/inc/people-grid.php +++ b/inc/people-grid.php @@ -1,143 +1,142 @@ -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('department', $information_to_display)) { - echo '

'; - $departmentPieces = explode(";", get_field('department')); - foreach( $departmentPieces as $d ){ - echo ( !empty($d) ? "{$d}
": "" ); - } - 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['url']); - 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('campus', $information_to_display)) { - echo '

'; - the_field('campus'); - 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 '

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

'.get_field('url').'

'; - }; ?> -
-
- -
'; - } - $person_count++; - } //end of posts?> -
- - \ No newline at end of file +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('department', $information_to_display)) { + echo '

'; + $departmentPieces = explode(";", get_field('department')); + foreach( $departmentPieces as $d ){ + echo ( !empty($d) ? "{$d}
": "" ); + } + 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['url']); + 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('campus', $information_to_display)) { + echo '

'; + the_field('campus'); + 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 '

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

'.get_field('url').'

'; + }; ?> +
+
+ +
'; + } + $person_count++; + } //end of posts?> +
+ \ No newline at end of file diff --git a/inc/people-table.php b/inc/people-table.php index c936b76..b01cc82 100644 --- a/inc/people-table.php +++ b/inc/people-table.php @@ -1,145 +1,145 @@ -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 ''; - } - if (in_array('department', $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('campus', 'campus'); - createTextCell('office_hours', 'office_hours'); - createTextCell('courses', 'courses'); - if (in_array('url', $information_to_display)) { - echo ''; - }; - - - - 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 '
'; - $departmentPieces = explode(";", get_field('department')); - foreach( $departmentPieces as $d ){ - echo ( !empty($d) ? "{$d}
": "" ); - } - echo '
'; - $file = get_field('file'); - echo ''.$file[title].''; - echo ''; - echo ''.get_field('email').''; - echo ''; - echo str_replace(';','
',get_field('mailing_address')); - echo '
'; - echo ''.get_field('url').''; - 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 ''; + } + if (in_array('department', $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('campus', 'campus'); + createTextCell('office_hours', 'office_hours'); + createTextCell('courses', 'courses'); + if (in_array('url', $information_to_display)) { + echo ''; + }; + + + + 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 '
'; + $departmentPieces = explode(";", get_field('department')); + foreach( $departmentPieces as $d ){ + echo ( !empty($d) ? "{$d}
": "" ); + } + echo '
'; + $file = get_field('file'); + echo ''.$file[title].''; + echo ''; + echo ''.get_field('email').''; + echo ''; + echo str_replace(';','
',get_field('mailing_address')); + echo '
'; + echo ''.get_field('url').''; + echo '
+ + \ No newline at end of file diff --git a/user-people.php b/user-people.php index 14a50f2..eea5cf8 100644 --- a/user-people.php +++ b/user-people.php @@ -1,218 +1,218 @@ - -
- - - -
-
-
-
-
> -
- ', '' ); ?> -
-
- -
- ', '' ); ?> -
-
- -1, - 'post_type' => 'person', - '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" ); - $specific_people = get_field( "specific_people" ); - $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)) { - 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); - } - $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) { - $group_query = array( - 'taxonomy' => 'group', - 'field' => 'term_id', - 'terms' => $specific_groups - ); - array_push($tax_query, $group_query); - } - if ($specific_tags != false) { - $isTagSet = true; - $tag_query = array( - 'taxonomy' => 'persontag', - 'field' => 'term_id', - 'terms' => $specific_tags - ); - 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. - $people = $the_query->posts; - - // 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; - $terms = get_the_terms($id, 'group'); - if (is_array($terms)){ - foreach($terms as $key => $value){ - //duplicates will overwrite themselves... - $slug = $value->slug; - $groups_in_use[$slug]= $slug; - } - }; - } - if(!empty($specific_groups) && is_array($specific_groups)){ - $groups_in_use = array(); - foreach($specific_groups as $group){ - $group = get_term_by('id', $group, 'group'); - $groups_in_use[] = $group->slug; - } - } - // sort the groups in use alphabetically - //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. - $tax_query = array(); - $group_query = array( - 'taxonomy' => 'group', - 'field' => 'slug', - 'terms' => $value - ); - array_push($tax_query, $group_query); - if( $isTagSet != false ){ - array_push($tax_query, $tag_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'); - } - 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'); - } - - } - ?> - - -
-
-
-
-
-
- -
- - -
- + +
+ + + +
+
+
+
+
> +
+ ', '' ); ?> +
+
+ +
+ ', '' ); ?> +
+
+ -1, + 'post_type' => 'person', + '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" ); + $specific_people = get_field( "specific_people" ); + $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)) { + 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); + } + $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) { + $group_query = array( + 'taxonomy' => 'group', + 'field' => 'term_id', + 'terms' => $specific_groups + ); + array_push($tax_query, $group_query); + } + if ($specific_tags != false) { + $isTagSet = true; + $tag_query = array( + 'taxonomy' => 'persontag', + 'field' => 'term_id', + 'terms' => $specific_tags + ); + 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. + $people = $the_query->posts; + + // 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; + $terms = get_the_terms($id, 'group'); + if (is_array($terms)){ + foreach($terms as $key => $value){ + //duplicates will overwrite themselves... + $slug = $value->slug; + $groups_in_use[$slug]= $slug; + } + }; + } + if(!empty($specific_groups) && is_array($specific_groups)){ + $groups_in_use = array(); + foreach($specific_groups as $group){ + $group = get_term_by('id', $group, 'group'); + $groups_in_use[] = $group->slug; + } + } + // sort the groups in use alphabetically + //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. + $tax_query = array(); + $group_query = array( + 'taxonomy' => 'group', + 'field' => 'slug', + 'terms' => $value + ); + array_push($tax_query, $group_query); + if( $isTagSet != false ){ + array_push($tax_query, $tag_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'); + } + 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'); + } + + } + ?> + + +
+
+
+
+
+
+ +
+ + +
+ \ No newline at end of file