diff --git a/templates/archive-programs.php b/templates/archive-programs.php
index 81550b6..ff82ab7 100644
--- a/templates/archive-programs.php
+++ b/templates/archive-programs.php
@@ -224,18 +224,17 @@ if(isset($_GET['sponsorship']) && strlen($_GET['sponsorship']) > 0){
if(isset($_GET['scholarships']) && strlen($_GET['scholarships']) > 0){
$apiparams[] = $scholarships['meta']['id'].'='.urlencode($_GET['scholarships']).'|'.$scholarships['meta']['id'].'_t='.$scholarships['meta']['type'];
}
-//print_r($apiparams);
//if(strlen($apiargs) > 0){
if(count($apiparams) > 0){
$apiargs .= '¶ms='.implode('|', $apiparams);
}
//echo 'here';
- $response = wp_remote_get( $api.$apiargs );
+ $response = wp_remote_get( $api.$apiargs, array('timeout' => 10) );
if( is_array($response) && isset($response['body']) && strlen($response['body']) > 0 ) {
$search_results = json_decode($response['body']);
}
- //print_r($search_results);
+ //print_r($response);
//}
?>
@@ -245,13 +244,14 @@ if(isset($_GET['scholarships']) && strlen($_GET['scholarships']) > 0){
'UConn Faculty-Led',
- 'exchange-partner' => 'Exchange',
+ 'uconn-faculty-led|exchange-partner' => 'UConn Programs',
+ //'exchange-partner' => 'Exchange',
//'ct-bw-exchange' => 'CT - BW Exchange',
- '3rd-party-direct-enroll' => '3rd Party/Direct Enroll',
- 'non-uconn' => 'Open to Non-UConn Students',
- '' => 'All Programs'
+ '3rd-party-direct-enroll' => 'Non-UConn Programs',
+ //'non-uconn' => 'Open to Non-UConn Students',
+ 'all' => 'All Programs'
);
+if(!isset($_GET['category']) || strlen($_GET['category']) == 0 || !isset($programTabIDs[$_GET['category']])) $_GET['category'] = 'uconn-faculty-led|exchange-partner';
?>
@@ -264,7 +264,11 @@ $programTabIDs = array(
$title ){
- echo ''.$title.'';
+ echo ''.$title.'';
}
?>
@@ -448,13 +452,17 @@ if(($search_results && $search_results->RECORDCOUNT > 0)){
'posts_per_page' => -1
//'posts_per_page' => $num, incorrect way to get shows
);
- if(isset($_GET['category']) && strlen($_GET['category']) > 0){
- $args['tax_query'] = array(
- array(
+ if(isset($_GET['category']) && strlen($_GET['category']) > 0 && $_GET['category'] != 'all'){
+ $args['tax_query'] = array();
+ $category = explode('|', $_GET['category']);
+ foreach($category as $cat){
+ $args['tax_query'][] = array(
'taxonomy' => 'category',
'field' => 'slug',
- 'terms' => $_GET['category']
- ));
+ 'terms' => $cat
+ );
+ }
+ if(count($args['tax_query']) > 1) $args['tax_query']['relation'] = 'OR';
}
if(isset($_GET['search']) && strlen($_GET['search']) > 0){
$args['s'] = $_GET['search'];
@@ -494,9 +502,28 @@ if(($search_results && $search_results->RECORDCOUNT > 0)){
+ if(!empty($posts)):
+ $groups = array();
+ foreach($programTabIDs as $key => $val){
+ $groups[$key] = array();
+ }
+ foreach($posts as $post){
+ foreach($programTabIDs as $key => $val){
+ foreach(get_the_category($post->ID) as $category){
+ if(strstr($key,$category->slug)){
+ $groups[$key][] = $post;
+ }
+ }
+ }
+ }
+ //print_r($groups);
+
+ //exit;
+ function display($posts = array()){
+ foreach($posts as $post){
+ ?>
ID);
$search = array(" ", "/");
$replace = array("", "-");?>
-
-
+ ?>">
+ ID,'large');?>
-
+ ID); ?>
-
+ $group){
+ if($key == 'all') continue;
+ echo ''.$programTabIDs[$key].'
';
+ display($group);
+ }
+ }
+ else{
+ echo ''.$programTabIDs[$_GET['category']].'
';
+ display($posts);
+ }
+ ?>