This repository has been archived by the owner. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
uc-abroad/templates/programs-content-columns.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
145 lines (142 sloc)
4.47 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*$currentTerm comes from the page template it was included from: | |
page-programs, page-pexchange, page-puconnin, page-party, page-ptemporary | |
*/ | |
?> | |
<section class="container"> | |
<div class="tab-content"> | |
<!-- Grid Start --> | |
<div class="tab-pane active" id="tab1"> | |
<div class="program-container"> | |
<ul class="program-grid"> | |
<?php | |
$args = array( | |
'post_type' => 'program', | |
'orderby' => 'title', | |
'order' => 'ASC', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'category', | |
'field' => 'slug', | |
'terms' => $currentTerm | |
)), | |
'posts_per_page' => -1 | |
//'posts_per_page' => $num, incorrect way to get shows | |
); | |
$posts = get_posts($args); | |
?> | |
<?php | |
if(!empty($posts)): foreach($posts as $post): setup_postdata($post); ?> | |
<?php | |
$tags = get_the_tags(); | |
$search = array(" ", "/"); | |
$replace = array("", "-");?> | |
<li class="program-box<?php | |
if($tags){ | |
$add_all_countries_tag = false; | |
$add_all_regions_tag = false; | |
$add_all_cities_tag = false; | |
$add_all_terms_tag = false; | |
foreach($tags as $tag) { | |
if(!$add_all_countries_tag && in_array($tag->name,$countries)) { | |
$add_all_countries_tag = true; | |
$tempTag = new stdClass(); | |
$tempTag->name = 'allcountries'; | |
array_push($tags, $tempTag); | |
} | |
if(!$add_all_regions_tag && in_array($tag->name,$regions)) { | |
$add_all_regions_tag = true; | |
$tempTag = new stdClass(); | |
$tempTag->name = 'allregions'; | |
array_push($tags, $tempTag); | |
} | |
if(!$add_all_cities_tag && in_array($tag->name,$cities)) { | |
$add_all_cities_tag = true; | |
$tempTag = new stdClass(); | |
$tempTag->name = 'allcities'; | |
array_push($tags, $tempTag); | |
} | |
if(!$add_all_terms_tag && in_array($tag->name,$terms)) { | |
$add_all_terms_tag = true; | |
$tempTag = new stdClass(); | |
$tempTag->name = 'allterms'; | |
array_push($tags, $tempTag); | |
} | |
} | |
foreach($tags as $tag){ | |
echo ' '.strtolower(str_replace($search, $replace, $tag->name)); | |
} | |
} | |
?>"> <a href="<?php the_permalink() ?>"> | |
<?php the_post_thumbnail();?> | |
<span class="program-name"> | |
<?php the_title(); ?> | |
</span> </a> </li> | |
<?php endforeach;?> | |
<?php else: ?> | |
<p> | |
<?php _e('Sorry, no exchange programs are listed.'); ?> | |
</p> | |
<?php endif; ?> | |
</ul> | |
</div> | |
</div> | |
<!-- Grid End --> | |
<!-- List Start --> | |
<div class="tab-pane" id="tab2"> | |
<ol class="program-list-view" > | |
<?php | |
$args = array( | |
'post_type' => 'program', | |
'orderby' => 'title', | |
'order' => 'ASC', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'category', | |
'field' => 'slug', | |
'terms' => $currentTerm | |
)), | |
'posts_per_page' => -1 | |
//'posts_per_page' => $num, incorrect way to get shows | |
); | |
$posts = get_posts($args); | |
//var_dump($posts); | |
?> | |
<?php if(!empty($posts)): foreach($posts as $post): setup_postdata($post); ?> | |
<?php $tags = get_the_tags(); | |
$search = array(" ", "/"); | |
$replace = array("", "-");?> | |
<li class="program-list <?php if($tags){ foreach($tags as $tag){echo ' '.strtolower(str_replace($search, $replace, $tag->name));} } ?>"> | |
<ul id="badge-list" class"program-info"> | |
<a href="<?php the_permalink() ?>"> | |
<li class="list-img"> | |
<?php the_post_thumbnail();?> | |
</li> | |
<li class="list-title"> | |
<?php the_title(); ?> | |
</li> | |
<li class="list-city"> | |
</li> | |
<li class="list-country"> | |
<?php $key="program-country"; echo get_post_meta($post->ID, $key, true); ?> | |
</li> | |
<li class="list-region"> | |
<?php $key="program-region"; echo get_post_meta($post->ID, $key, true); ?> | |
</li> | |
<li class="list-semester"> | |
<?php $key="program-semester"; echo get_post_meta($post->ID, $key, true); ?> | |
</li> | |
</a> | |
</ul> | |
</li> | |
<?php endforeach?> | |
<?php else: ?> | |
<p> | |
<?php _e('Sorry, no exchange programs are listed.'); ?> | |
</p> | |
<?php endif; ?> | |
</ol> | |
</div> | |
<!-- List End --> | |
</div> | |
</section> |