Skip to content
This repository has been archived by the owner. It is now read-only.

Adding code from old plugin #2

Merged
merged 1 commit into from
Apr 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
647 changes: 644 additions & 3 deletions grandchild-functions.php

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions grandchild-scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
jQuery(document).ready(function($){
var degreeFilters = [];
var aoiFilters = [];
$('.degree-filter').change(function(){
degreeFilters = [];
$('.degree-filter:checked').each(function(){
degreeFilters.push($(this).val());
});
doFilter();
});
$('.aoi-filter').change(function(){
aoiFilters = [];
$('.aoi-filter:checked').each(function(){
aoiFilters.push($(this).val());
});
doFilter();
});
var doFilter = function(){
var filters = $.merge($.merge( [], degreeFilters), aoiFilters);
//console.log(degreeFilters);
//console.log(aoiFilters);
//console.log(filters);
$('.program-grid').children().each(function(){
$(this).css('display','block');
var classes = $(this).attr('class').split(' ');
for(var i in filters){
if($.inArray(filters[i],classes) === -1){
$(this).css('display','none');
break;
}
}
});
};
});
4 changes: 2 additions & 2 deletions template-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ private function __construct() {

// Add your templates to this array.
$this->templates = array(
'page-sample.php' => __( 'Sample', $this->plugin_slug ),
'page-grid-stories.php' => __( 'Page - Grid Stories', $this->plugin_slug ),
//'page-sample3.php' => __( 'Sample3', $this->plugin_slug ),
'page-course-subjects.php' => __( 'Course-Subjects', $this->plugin_slug ),
'page.php' => __( 'Page', $this->plugin_slug ),
);

// adding support for theme templates to be merged and shown in dropdown
Expand Down
15 changes: 10 additions & 5 deletions templates/_notes/dwsync.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="header.php" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131249130868374454" remote="131249130860000000" Dst="1" />
<file name="nav.php" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131305451394201363" remote="131305451410000000" Dst="1" />
<file name="footer.php" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131208603837071213" remote="131208603830000000" Dst="2" />
<file name="nav-tabs.php" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131312169300000000" remote="131312169300000000" Dst="1" />
<file name="nav-drop-multi-walker.php" server="development.wordpress.uconn.edu/edu.uconn.wordpress.development/public_html/wp-content/" local="131249145180000000" remote="131249145180000000" Dst="1" />
<file name="page-course-subjects.php" server="development.wordpress.uconn.edu" local="131357888710000000" remote="131357888710000000" Dst="2" />
<file name="single-courses.php" server="development.wordpress.uconn.edu" local="131357884180000000" remote="131357884180000000" Dst="2" />
<file name="footer.php" server="development.wordpress.uconn.edu" local="131208603830000000" remote="131208603830000000" Dst="2" />
<file name="header.php" server="development.wordpress.uconn.edu" local="131249094860000000" remote="131249094860000000" Dst="2" />
<file name="nav-tabs.php" server="development.wordpress.uconn.edu" local="131354438760000000" remote="131354438760000000" Dst="2" />
<file name="nav.php" server="development.wordpress.uconn.edu" local="131305415410000000" remote="131305415410000000" Dst="2" />
<file name="archive-programs.php" server="development.wordpress.uconn.edu" local="131353628180000000" remote="131353628180000000" Dst="2" />
<file name="nav-drop-multi-walker.php" server="development.wordpress.uconn.edu" local="131249109180000000" remote="131249109180000000" Dst="2" />
<file name="taxonomy-subjects.php" server="development.wordpress.uconn.edu" local="131357884190000000" remote="131357884190000000" Dst="2" />
<file name="page.php" server="development.wordpress.uconn.edu" local="131357887810000000" remote="131357887810000000" Dst="2" />
</dwsync>
139 changes: 139 additions & 0 deletions templates/archive-programs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
<?php
/*
Template Name: Programs
*/
?>
<?php get_header(); ?>

<?php
$args = array(
'post_type' => 'programs',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => -1
);
$posts = get_posts($args);
?>

<div id="page-sorting-programs">

<div class="sorting-degrees clearfix">
<div class="col-md-2">
<h2>Degrees</h2>
</div>

<div class="col-md-10">
<form>
<ul>
<li><input type="checkbox" class="degree-filter" name="masters" value="masters" id="masters"><label for="masters">Master's</label></li>
<li><input type="checkbox" class="degree-filter" name="doctoral" value="doctoral" id="doctoral"><label for="doctoral">Doctoral/PhD</label></li>
<li><input type="checkbox" class="degree-filter" name="certificate" value="certificate" id="certificate"><label for="certificate">Certificate</label></li>
<li><input type="checkbox" class="degree-filter" name="online" value="online" id="online"><label for="online">Online</label></li>
</ul>
</form>
</div>

</div>

<div class="sorting-areas-of-interest clearfix">
<div class="col-md-2">
<h2>Areas of Interest</h2>
</div>
<div class="col-md-10">
<form>
<ul>
<li><input type="checkbox" class="aoi-filter" name="agriculture" value="agriculture" id="agriculture"><label for="agriculture">Agriculture</label></li>
<li><input type="checkbox" class="aoi-filter" name="business" value="business" id="business"><label for="business">Business</label></li>
<li><input type="checkbox" class="aoi-filter" name="education" value="education" id="education"><label for="education">Education</label></li>
<li><input type="checkbox" class="aoi-filter" name="engineering" value="engineering" id="engineering"><label for="engineering">Engineering</label></li>
<li><input type="checkbox" class="aoi-filter" name="fine-arts" value="fine-arts" id="fine-arts"><label for="fine-arts">Fine Arts</label></li>
<li><input type="checkbox" class="aoi-filter" name="health" value="health" id="health"><label for="health">Health</label></li>
<li><input type="checkbox" class="aoi-filter" name="humanities" value="humanities" id="humanities"><label for="humanities">Humanities</label></li>
<li><input type="checkbox" class="aoi-filter" name="natural-sciences" value="natural-sciences" id="natural-sciences"><label for="natural-sciences">Natural Sciences</label></li>
<li><input type="checkbox" class="aoi-filter" name="social-sciences" value="social-sciences" id="social-sciences"><label for="social-sciences">Social Sciences</label></li>
</ul>
</form>
</div>
</div>


<section id="program-wrapper" class="program-content clearfix">
<div class="program-container">

<?php if(!empty($posts)): ?>
<ul class="program-grid">
<?php
foreach($posts as $post): setup_postdata($post);
$degrees = get_post_meta( get_the_ID(), 'degree_filter');
$aois = get_post_meta( get_the_ID(), 'areas_of_interest_filter');
?>
<div class="col-sm-3 <?php
if(isset($degrees[0])) echo implode(' ',$degrees[0]).' ';
if(isset($aois[0])) echo implode(' ',$aois[0]).' ';
?>">
<li class="program-box">
<div class="img-wrap">
<a href="<?php echo get_post_meta( get_the_ID(), 'program_url', true ); ?>">
<?php the_post_thumbnail('large');?>
</a>
</div>
<div class="program-name-wrap <?php echo 'color-'.get_post_meta( get_the_ID(), 'areas_of_interest_color', true ); ?>"> <!------------ (Josh it up) - Add a class name here so I can change the color of the box -------------->
<a class="program-name" href="<?php echo get_post_meta( get_the_ID(), 'program_url', true ); ?>">
<?php the_title(); ?>
</a>
</div>
<div class="details-wrap <?php echo 'color-'.get_post_meta( get_the_ID(), 'areas_of_interest_color', true ); ?>"> <!------------ (Josh it up) - Add the same class name from above so I can change the color of the box -------------->
<div class="department-website">
<a href="<?php echo get_post_meta( get_the_ID(), 'program_url', true ); ?>">Department Website</a>
</div>
<div class="concentrations">
<a data-toggle="modal" data-target="#concentrations<?php the_ID(); ?>">View Concentrations</a> <!------------ (Josh it up) - Opens modal -------------->
</div>
<div class="phone-number">
<p><?php echo get_post_meta( get_the_ID(), 'phone_number', true ); ?></p>
</div>

<p class="degrees">
<?php echo get_post_meta( get_the_ID(), 'degrees', true ); ?>
</p>


</div>

</li>
</div>
<?php endforeach;?>
</ul>
<?php else: ?>
<p>
<?php _e('Sorry, no programs exist.'); ?>
</p>
<?php endif; ?>

</div>
</section>
</div>
<?php if(!empty($posts)): ?>
<?php
foreach($posts as $post): setup_postdata($post); ?>
<div class="modal fade" id="concentrations<?php the_ID(); ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Concentrations</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<?php echo get_post_meta( get_the_ID(), 'concentrations', true ); ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<?php endforeach;?>
<?php endif; ?>
<?php get_footer(); ?>
2 changes: 1 addition & 1 deletion templates/nav-tabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div>
<label class="screen-reader-text" for="s"><?php _x( 'Search for:', 'label' ); ?></label>
<input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" />
<input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" title="Search Grad School... " placeholder="Search Grad School... " />
<button type="submit" class="btn btn-default" title="Search">
<i class="glyphicon glyphicon-search"></i><span class="sr-only">Search</span></button>
</div>
Expand Down
121 changes: 121 additions & 0 deletions templates/page-course-subjects.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php
/*
Template Name: Course Subjects
*/
get_header(); ?>
<?php //Grabs most parent page's featured image for background of title.
while (have_posts()) : the_post();
$parent = array_reverse(get_post_ancestors(get_the_ID()));
$first_parent = get_page($parent[0]);
$first_parent_Id = $first_parent->ID;
$url = wp_get_attachment_image_src( get_post_thumbnail_id($first_parent_Id), 'full');
endwhile?>


<?php include(get_template_directory().'/inc/sidebar-check.php')?>
<div id="page-page">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<div class="row">
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>">
<div id="primary" class="content-area subpage">
<main id="main" class="site-main" role="main">

<?php get_template_part( 'content', 'page' ); ?>

<?php

// Alphabet array
$alpharay = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');

// Letter navigation
echo '<ul class="letter-list clearfix">';
foreach($alpharay as $letter) {
echo '<li><a href="#letter-' . $letter . '">' . $letter . '</a></li>';
};
echo '</ul>';

// Counter for proper .row and .span placement
$colcount = 0;

// Course Subject Query args
$args = array(
'type' => 'post',
'child_of' => 0,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => '',
'taxonomy' => 'subjects',
'pad_counts' => false
);

// Subject Taxonomy array
$subject_list = get_categories($args);

// Start by looping through the alphabet array
foreach( $alpharay as $letter ) {
$letter_exists = 0;

// Determine whether there are subjects that start with current letter
foreach($subject_list as $subject) {
if(strpos($subject->name, $letter) === 0) {
$letter_exists = 1;
};
};

// Perform if subjects exist starting with current letter
if($letter_exists) {

// Create small list for each letter
if($colcount) {
echo '<div class="col-sm-6 alph-subj-list columns" id="letter-' . $letter . '">';
echo '<h2>' . $letter . '</h2>';
echo '<ul class="course-alpha-list">';

foreach( $subject_list as $subject ) {
if(strpos($subject->name, $letter) === 0) {
$subject_link = get_home_url() . '/graduate-courses/' . $subject->slug;
echo '<li><a href="' . $subject_link . '">' . $subject->description . ' (' . $subject->name . ')</a></li>';
};
};

echo '</ul>';
echo '</div>';
echo '</div>';
$colcount = 0;
} else {
echo '<div class="row">';
echo '<div class="col-sm-6 alph-subj-list columns" id="letter-' . $letter . '">';
echo '<h2>' . $letter . '</h2>';
echo '<ul class="course-alpha-list">';

foreach( $subject_list as $subject ) {
if(strpos($subject->name, $letter) === 0) {
$subject_link = get_home_url() . '/graduate-courses/' . $subject->slug;
echo '<li><a href="' . $subject_link . '">' . $subject->description . ' (' . $subject->name . ')</a></li>';
};
};

echo '</ul>';
echo '</div>';
$colcount++;
};
};

};

?>
</main>
</div>

</div>
<?php include(get_template_directory().'/inc/sidebar-if-active.php')?>
</div>
<?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>
38 changes: 38 additions & 0 deletions templates/page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package cornerstone
*/

get_header(); ?>
<?php include get_template_directory().'/inc/sidebar-check.php';?>
<div id="page-page">
<?php if (have_posts()) : while ( have_posts() ) : the_post(); ?>
<?php include get_template_directory().'/inc/submenu-check.php'; ?>
<div class="row">
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>">
<div id="primary" class="content-area subpage">
<main id="main" class="site-main" role="main">
<!--<?php gradschool_breadcrumbs(); ?> -->
<?php get_template_part( 'content', 'page' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) :
comments_template();
endif;
?>
</main>
</div>
</div>
<?php include get_template_directory().'/inc/sidebar-if-active.php';?>
</div>
<?php include get_template_directory().'/inc/submenu-closing-tags.php';?>
<?php endwhile; endif; // end of the loop. ?>
</div>
<?php get_footer(); ?>
Loading