|
@@ -224,18 +224,17 @@ |
|
|
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 '<a href="'.$api.$apiargs.'">here</a>'; |
|
|
$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); |
|
|
//} |
|
|
?> |
|
|
<?php get_header(); ?> |
|
@@ -245,13 +244,14 @@ |
|
|
<?php |
|
|
$programTabIDs = array( |
|
|
|
|
|
'uconn-faculty-led' => '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'; |
|
|
?> |
|
|
|
|
|
<section id="program-container" class="program-content clearfix"> |
|
@@ -264,7 +264,11 @@ |
|
|
|
|
|
<?php |
|
|
foreach( $programTabIDs as $id => $title ){ |
|
|
echo '<a type="button" class="btn btn-default'.((isset($_GET['category']) && $_GET['category'] == $id ) || (strlen($id) ==0 && (!isset($_GET['category'])||strlen($_GET['category']) == 0))? ' active': '' ).'" href="?category='.$id.'">'.$title.'</a>'; |
|
|
echo '<a type="button" class="btn btn-default'; |
|
|
if(isset($_GET['category']) && strstr($id, $_GET['category'])){ |
|
|
echo ' active'; |
|
|
} |
|
|
echo '" href="?category='.$id.'">'.$title.'</a>'; |
|
|
} |
|
|
?> |
|
|
|
|
@@ -448,13 +452,17 @@ |
|
|
'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 @@ |
|
|
<div class="program-container"> |
|
|
<ul class="program-grid"> |
|
|
<?php |
|
|
if(!empty($posts)): foreach($posts as $post): setup_postdata($post); ?> |
|
|
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){ |
|
|
?> |
|
|
<?php |
|
|
$tags = get_the_tags(); |
|
|
$tags = get_the_tags($post->ID); |
|
|
$search = array(" ", "/"); |
|
|
$replace = array("", "-");?> |
|
|
<li class="program-box<?php |
|
@@ -535,12 +562,25 @@ |
|
|
echo ' '.strtolower(str_replace($search, $replace, $tag->name)); |
|
|
} |
|
|
} |
|
|
?>"> <a href="<?php the_permalink() ?>"> |
|
|
<?php the_post_thumbnail('large');?> |
|
|
?>"> <a href="<?php echo get_the_permalink($post->ID); ?>"> |
|
|
<?php echo get_the_post_thumbnail($post->ID,'large');?> |
|
|
<span class="program-name"> |
|
|
<?php the_title(); ?> |
|
|
<?php echo get_the_title($post->ID); ?> |
|
|
</span> </a> </li> |
|
|
<?php endforeach;?> |
|
|
<?php } |
|
|
} // end function display |
|
|
if($_GET['category'] == 'all'){ |
|
|
foreach($groups as $key=>$group){ |
|
|
if($key == 'all') continue; |
|
|
echo '<h2 style="clear:left">'.$programTabIDs[$key].'</h2>'; |
|
|
display($group); |
|
|
} |
|
|
} |
|
|
else{ |
|
|
echo '<h2 style="clear:left">'.$programTabIDs[$_GET['category']].'</h2>'; |
|
|
display($posts); |
|
|
} |
|
|
?> |
|
|
<?php else: ?> |
|
|
<p> |
|
|
<?php _e('Sorry, no exchange programs are listed.'); ?> |
|
|