Last active
December 22, 2015 20:19
-
-
Save fabrizim/6525184 to your computer and use it in GitHub Desktop.
single-faculty.php
This file contains hidden or 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 | |
global $post; | |
wp_enqueue_script('department-popovers'); | |
the_post(); | |
get_header(); | |
get_sidebar('breadcrumbs'); | |
$model = Snap::inst('WSE_Model_Faculty')->load( get_the_ID() ); | |
$sections = array( | |
'education' => 'Education', | |
'experience' => 'Experience', | |
'research_areas' => 'Research Areas', | |
'awards' => 'Awards', | |
'committees' => 'Committees' | |
); | |
$publications = array( | |
'journal_articles' => 'Journal Articles', | |
'books' => 'Books', | |
'book_chapters' => 'Book Chapters', | |
'other_publications' => 'Other Publications', | |
'conference_proceedings' => 'Conference Proceedings', | |
'patents' => 'Patents' | |
); | |
$projects = Snap::inst('WSE_PostType_Faculty')->get_research_projects( get_the_ID() ); | |
$has_publications = false; | |
foreach( $publications as $pub ){ | |
if( count( $model->get('folio_'.$pub) ) ){ | |
$has_publications = true; | |
break; | |
} | |
} | |
?> | |
<article class="primary grid-with-gutters"> | |
<div class="row"> | |
<div class="span8"> | |
<div class="row"> | |
<div class="span3"> | |
<?php | |
$src = wp_get_attachment_image_src( get_post_thumbnail_id( $primary->ID ), 'large' ); | |
?> | |
<img src="<?= $src[0] ?>" alt="<?= esc_attr($primary->post_title) ?>" /> | |
</div> | |
<div class="span5"> | |
<div class="post-display-label"> | |
Faculty | |
</div> | |
<h1 class="page-title"> | |
<?php the_title() ?> | |
</h1> | |
<div class="faculty-profile-info"> | |
<div class="intro"> | |
<?= apply_filters('the_content', $model->get('title')) ?> | |
</div> | |
<div class="research-areas"> | |
<h4>Research Interests</h4> | |
<?= apply_filters('the_content', $model->get('research_areas')) ?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="tabbable"> | |
<ul class="nav nav-tabs" id="profile-tabs"> | |
<li class="active"><a href="#bio" data-toggle="tab">Bio</a></li> | |
<?php | |
if( count( $projects ) ) { | |
?> | |
<li><a href="#research" data-toggle="tab">Research</a></li> | |
<?php | |
} | |
if( $has_publications ){ | |
?> | |
<li><a href="#publications" data-toggle="tab">Publications</a></li> | |
<?php | |
} | |
if( count((array)$model->get('folio_presentations')) ){ | |
?> | |
<li><a href="#presentations" data-toggle="tab">Presentations</a></li> | |
<?php | |
} | |
?> | |
</ul> | |
<div class="tab-content"> | |
<div class="tab-pane active" id="bio"> | |
<div class="bio"> | |
<?php the_content() ?> | |
</div> | |
<?php | |
foreach( $sections as $name => $label ){ | |
$items = (array) $model->get('folio_'.$name); | |
if( !count($items) ) continue; | |
?> | |
<div class="faculty-profile-section" id="faculty-profile-section-<?= $name ?>"> | |
<h6><?= $label ?></h6> | |
<ul> | |
<?php | |
foreach( $items as $item ){ | |
?> | |
<li><?= $item ?></li> | |
<?php | |
} | |
?> | |
</ul> | |
</div> | |
<?php | |
} | |
?> | |
</div> | |
<?php | |
if( count($projects) ){ | |
?> | |
<div class="tab-pane" id="research"> | |
<ul class="research-project-list"> | |
<?php | |
foreach( $projects as $project ){ | |
$post = $project; | |
setup_postdata( $post ); | |
?> | |
<li> | |
<?php | |
get_template_part('card','research-project'); | |
?> | |
</li> | |
<?php | |
} | |
?> | |
</ul> | |
</div> | |
<?php | |
wp_reset_postdata(); | |
} | |
if( $has_publications ){ | |
?> | |
<div class="tab-pane" id="publications"> | |
<?php | |
foreach( $publications as $name => $label ){ | |
$items = (array) $model->get('folio_'.$name); | |
if( !count($items) ) continue; | |
?> | |
<div class="faculty-profile-section" id="faculty-profile-section-<?= $name ?>"> | |
<h6><?= $label ?></h6> | |
<ul> | |
<?php | |
foreach( $items as $item ){ | |
?> | |
<li><?= $item['original'] ?></li> | |
<?php | |
} | |
?> | |
</ul> | |
</div> | |
<?php | |
} | |
?> | |
</div> | |
<?php | |
} | |
$items = (array) $model->get('folio_presentations'); | |
if( count( $items ) ){ | |
?> | |
<div class="tab-pane" id="presentations"> | |
<div class="faculty-profile-section" id="faculty-profile-section-presentations"> | |
<ul> | |
<?php | |
foreach( $items as $item ){ | |
?> | |
<li><?= $item ?></li> | |
<?php | |
} | |
?> | |
</ul> | |
</div> | |
</div> | |
<?php | |
} | |
?> | |
</div> | |
</div> | |
</div> | |
<div class="span4"> | |
<div class="sidebar right-sidebar"> | |
<div class="faculty-information"> | |
<div class="primary dark-sidebar-area"> | |
<a class="back-link" href="<?= get_post_type_archive_link('faculty') ?>"> | |
<i class="icon-backarrow"></i> Back to All Faculty | |
</a> | |
<ul class="info-table faculty-info"> | |
<?php | |
if( ($cv = get_field('cv')) ){ | |
?> | |
<li> | |
<i class="label-icon icon-world"></i> | |
<div class="value"> | |
<a target="_blank" href="<?= $cv ?>">CV <i class="icon-angle-right"></i></a> | |
</div> | |
</li> | |
<?php | |
} | |
if( ($email = get_field('cv')) ){ | |
?> | |
<li> | |
<i class="label-icon icon-envelope-alt"></i> | |
<div class="value"> | |
<a href="mailto:<?= $email ?>">Email <i class="icon-angle-right"></i></a> | |
</div> | |
</li> | |
<?php | |
} | |
if( ($phones = get_field('phones')) && count($phones) ) foreach( $phones as $phone ){ | |
?> | |
<li> | |
<i class="label-icon icon-iphone"></i> | |
<div class="value"> | |
<?= $phone['label'] ?> <?= $phone['number'] ?> | |
</div> | |
</li> | |
<?php | |
} | |
if( ($sites = get_field('websites')) && count($sites) ) foreach( $sites as $site ){ | |
?> | |
<li> | |
<i class="label-icon icon-world"></i> | |
<div class="value"> | |
<a href="<?= $site['url'] ?>" target="_blank"><?= $site['label'] ?> <i class="icon-angle-right"></i></a> | |
</div> | |
</li> | |
<?php | |
} | |
?> | |
</ul> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</article> | |
<script type="text/javascript"> | |
// check for hash tag... | |
jQuery(function($){ | |
if( !window.location.hash ) return; | |
var parts = window.location.hash.replace(/^#/, '').split(':'); | |
if( parts.length ){ | |
$('a[href="#'+parts.length+'"]').click(); | |
} | |
if( parts.length > 1){ | |
// we already have the scroll to included | |
$.scrollTo( $('#faculty-profile-section-'+parts[1]) ); | |
} | |
}); | |
</script> | |
<?php | |
get_footer(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment