forked from ywammontana/WaterTower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive-program.php
101 lines (73 loc) · 3.34 KB
/
archive-program.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* Program Archive Page Template
* This page template displays all of the programs
* we offer.
*
* Template Name: Programs Archive
*/
// Get Page ID from the slug
$page_id = get_id_by_slug( 'programs' );
// Get all program classifications
$program_classifications = get_terms( 'program_classification' );
get_header();
?>
<div class="row">
<div class="medium-9 columns archive-program-content-container entry">
<h1><?php echo get_the_title( $page_id ); ?></h1>
<?php echo get_post_field( 'post_content', $page_id ); ?>
<?php
// Loop through all of the program classifications
foreach ( $program_classifications as $program_classification ) {
$archive_program_query_args = array(
'nopaging' => true,
'post_type' => 'program',
'program_classification' => $program_classification->slug,
); ?>
<div id="<?php echo $program_classification->slug; ?>" data-magellan-destination="<?php echo $program_classification->slug; ?>" class="program-archive-programs-container">
<?php $archive_program_query = new WP_Query( $archive_program_query_args ); ?>
<?php if ( $archive_program_query->have_posts() ) : ?>
<h2 class="program-archive-title"><?php echo $program_classification->name; ?></h2>
<?php while ( $archive_program_query->have_posts() ) : $archive_program_query->the_post();
// Retrieve ProgramInfo Object
$program_info = new programInfo($post->ID); ?>
<div class="row program-archive-program-container">
<div class="medium-4 columns program-archive-program-image">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( 'medium' ); ?>
</a>
</div>
<div class="medium-8 columns program-archive-program-content">
<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
<?php
// Display Program Excerpt
echo get_excerpt_by_id( $post->ID, 38, false );
if ($program_info->rolling_enrollment_status == 1) {
echo '<span class="school-instance"><i class="fa fa-refresh"></i> Rolling Enrollment</span>';
} else {
if (count($program_info->schedule) > 0) {
foreach ($program_info->schedule as $school) {
echo '<a href="' . get_the_permalink() . '#upcoming-schools"><span class="school-instance"><i class="fa fa-thumb-tack"></i> ' . $school['quarter'] . '</span></a>';
}
}
}
?>
</div>
</div>
<?php
endwhile; ?>
<?php
endif; ?>
</div>
<?php wp_reset_postdata(); ?>
<?php
} ?>
</div>
<div class="medium-3 columns stick-to-parent-side-nav">
<div class="magellan-container" data-magellan-expedition>
<dl class="sub-nav side-nav-container side-nav-by-heading">
</dl>
</div>
</div>
</div>
<?php get_footer(); ?>