-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtaxonomy-colleges.php
212 lines (202 loc) · 8.77 KB
/
taxonomy-colleges.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
get_header();
$term = get_queried_object();
// Lead
$lead_copy = get_field( 'college_page_lead_copy', $term );
$lead_image = get_field( 'college_page_lead_image', $term )['url'] ?? null;
$college_url = get_field( 'colleges_url', $term );
$lead_cta_text = get_field( 'lead_cta_text', $term ) ?: 'Visit ' . str_replace( array( 'http://', 'https://' ), '', $college_url );
$lead_cta_url = get_field( 'lead_cta_url', $term ) ?: $college_url;
// Stats
$stats = get_field( 'stat', $term );
$stats_background = get_field( 'stats_background_image', $term )['url'] ?? null;
// Degree
$degree_title = get_field( 'degree_search_title', $term ) ?: 'Search Degrees';
$degree_copy = get_field( 'degree_search_copy', $term );
$degree_search_url = get_permalink( get_page_by_path( 'degree-search' ) );
$degree_types = get_field( 'degree_types_available', $term );
$degree_types = map_degree_types( $degree_types );
$top_degrees = display_top_degrees( $term );
$top_degrees_heading = get_field( 'top_degrees_heading', $term ) ?: 'Top College Degrees';
$custom_top_degrees_heading = get_field( 'top_degrees_custom_heading', $term );
$custom_top_degrees = display_custom_top_degrees( $term );
// CTA
$cta = get_field( 'college_page_cta_section', $term );
// News
$news_topic = get_field( 'news_topic', $term );
$spotlight = get_field( 'college_spotlight', $term );
// Display toggles
$display_lead_section = get_field( 'college_page_lead_display', $term );
$display_stats_section = get_field( 'college_page_stats_display', $term );
$display_degrees_section = get_field( 'college_page_degrees_display', $term );
$display_cta_section = get_field( 'college_page_cta_display', $term );
$display_news_section = get_field( 'college_page_news_display', $term );
?>
<article>
<?php if ( $display_lead_section ) : ?>
<section class="section-lead" id="intro" aria-label="Introduction">
<div class="container my-5">
<div class="row">
<div class="col-sm-12 col-md-8 lead">
<?php echo $lead_copy; ?>
</div>
<div class="col-sm-12 col-md-4">
<?php if( $lead_image ) : ?>
<img src="<?php echo $lead_image; ?>" alt="" class="img-fluid">
<?php endif; ?>
</div>
</div>
<?php if ( $lead_cta_url ): ?>
<div class="row">
<div class="col-12 text-center mt-3">
<a class="btn btn-primary" href="<?php echo $lead_cta_url; ?>" target="_blank"><?php echo $lead_cta_text; ?></a>
</div>
</div>
<?php endif; ?>
</div>
</section>
<?php endif; ?>
<?php if ( $stats && $display_stats_section ) : ?>
<section class="section-stats" id="stats" aria-label="Facts and figures">
<div class="media-background-container">
<img class="media-background object-fit-cover" srcset="<?php echo $stats_background; ?>" src="<?php echo $stats_background; ?>" alt="">
<div class="container my-5 fact-grid-wrap">
<div class="row fact-grid">
<?php
ob_start();
foreach ( $stats as $index => $stat ) :
$details_id = "fact-details-$index";
?>
<div class="col-sm-6 col-lg-4 fact-block">
<aside aria-labelledby="<?php echo $details_id; ?>">
<img
src="<?php echo $stat['icon']['url']; ?>"
alt="<?php echo $stat['icon']['alt']; ?>"
width="<?php echo $stat['icon']['width']; ?>"
height="<?php echo $stat['icon']['height']; ?>"
class="fact-header fact-header-lg fact-header-icon w-auto"
>
<div class="fact-details" id="<?php echo $details_id; ?>"><?php echo $stat["copy"]; ?></div>
</aside>
</div>
<?php
endforeach;
echo ob_get_clean();
?>
</div>
</div>
</div>
</section>
<?php endif; ?>
<?php if ( $display_degrees_section ) : ?>
<section class="section-degrees" id="degrees" aria-labelledby="section-degrees-heading">
<div class="jumbotron jumbotron-fluid bg-inverse mb-0">
<div class="container">
<div class="row">
<div class="col-lg-8">
<h2 id="section-degrees-heading" class="h1 mb-4 text-primary font-weight-black section-heading"><?php echo $degree_title; ?></h2>
<div class="mb-5"><?php echo $degree_copy; ?></div>
<div class="mb-5"><?php echo do_shortcode( '[ucf-degree-search placeholder="Search ' . $term->name . ' Degrees"]' ); ?></div>
<?php if ( $degree_types ) : ?>
<h3 class="browse-by-heading h6 heading-sans-serif text-uppercase">Or browse by:</h3>
<ul class="browse-by-list list-chevrons">
<?php foreach( $degree_types as $slug => $name ) : ?>
<li><a href="<?php echo sprintf( "%s%s/college/%s/", $degree_search_url, $slug, $term->slug ); ?>" class="text-inverse"><?php echo $name . 's'; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php if ( $top_degrees || $custom_top_degrees ): ?>
<div class="col-lg-1 hidden-md-down">
<hr class="hidden-xs hidden-sm hr-vertical mx-auto">
</div>
<div class="col-lg-3">
<?php if ( $top_degrees || ( ! $top_degrees && $custom_top_degrees && ! $custom_top_degrees_heading ) ) : ?>
<h3 class="h5 mb-3 hidden-md-down"><span class="badge badge-inverse"><?php echo $top_degrees_heading; ?></span></h3>
<a class="hidden-lg-up btn btn-outline-inverse btn-block mb-3 collapsed" data-toggle="collapse" data-target="#top-degree-collapse" href="#top-degree-collapse">
<?php echo $top_degrees_heading; ?> <span class="fa fa-chevron-circle-down" aria-hidden="true"></span>
</a>
<div id="top-degree-collapse" class="collapse d-lg-block">
<ul class="top-majors-list nav flex-column align-items-start list-unstyled pl-3">
<?php if ( $top_degrees ) : ?>
<?php echo $top_degrees; ?>
<?php endif; ?>
<?php if ( $custom_top_degrees && ! $custom_top_degrees_heading ) : ?>
<?php echo $custom_top_degrees; ?>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<?php if ( $custom_top_degrees && $custom_top_degrees_heading ) : ?>
<h3 class="h5 mt-3 mt-lg-4 mb-3 hidden-md-down"><span class="badge badge-inverse"><?php echo $custom_top_degrees_heading; ?></span></h3>
<a class="hidden-lg-up btn btn-outline-inverse btn-block mt-3 mt-lg-4 mb-3 collapsed" data-toggle="collapse" data-target="#custom-top-degree-collapse" href="#custom-top-degree-collapse">
<?php echo $custom_top_degrees_heading; ?> <span class="fa fa-chevron-circle-down" aria-hidden="true"></span>
</a>
<div id="custom-top-degree-collapse" class="collapse d-lg-block">
<ul class="top-majors-list nav flex-column align-items-start list-unstyled pl-3">
<?php echo $custom_top_degrees; ?>
</ul>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</section>
<?php endif; ?>
<?php if ( $cta && $display_cta_section ) : ?>
<?php echo do_shortcode( '[ucf-section slug="' . $cta->post_name . '" title="Next steps and learn more"]' ); ?>
<?php endif; ?>
<?php if ( $display_news_section ) : ?>
<section class="section-news" id="news" aria-labelledby="news-heading">
<div class="container my-5">
<div class="row justify-content-between align-items-end">
<div class="col-auto">
<h2 id="news-heading" class="mb-0"><?php echo ( $news_title = get_field( 'colleges_alias', 'colleges_' . $term->term_id ) ) ? $news_title . " News" : $term->name . " News"; ?></h2>
</div>
<div class="col-auto">
<a href="https://www.ucf.edu/news/tag/<?php echo $news_topic; ?>" class="text-decoration-none h6 text-uppercase d-block mb-0 mt-2 text-default">Check out more stories <span class="fa fa-external-link text-primary" aria-hidden="true"></span></a>
</div>
</div>
<hr class="mt-2">
<div class="row">
<div class="col-md-8 col-sm-12">
<?php echo do_shortcode( '[ucf-news-feed title="" layout="modern" topics="' . $news_topic . '"]' ); ?>
</div>
<?php if( $spotlight ) : ?>
<div class="col-md-4 col-sm-12">
<?php echo do_shortcode( '[ucf-spotlight slug="' . $spotlight->post_name . '"]' ); ?>
</div>
<?php endif; ?>
</div>
</div>
</section>
<?php endif; ?>
<?php if( $sections = get_field( 'section_content', 'colleges_' . $term->term_id ) ) : ?>
<?php
if( $sections ) :
foreach( $sections as $section ) :
if ( $section['display'] ) {
$styles = UCF_Section_Common::get_post_section_styles( array( $section['section'] ) );
$scripts = UCF_Section_Common::get_post_section_javascript( array( $section['section'] ) );
if ( $styles ) : ?>
<style>
<?php echo implode( "\n", $styles ); ?>
</style>
<?php endif;
echo do_shortcode( '[ucf-section slug="' . $section['section']->post_name . '"]' );
if ( $scripts ) : ?>
<script>
<?php echo implode( "\n", $scripts ); ?>
</script>
<?php endif;
}
endforeach;
endif;
?>
<?php endif; ?>
<?php echo get_colleges_grid( $term ); ?>
</article>
<?php get_modals(); ?>
<?php get_footer(); ?>