-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.php
198 lines (154 loc) · 9.15 KB
/
home.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
<?php get_header(); ?>
<!-- background shapes -->
<div class="top-left-shapes">
<div class="big-rec-wrapper all-shapes-wrapper">
<div class="big-rec"></div>
<div class="sm-rec"></div>
<div class="background-cover"></div>
</div>
</div>
<main class="resources">
<div class="resources-title-container">
<h1>Resources</h1>
<p> Educational resources and guides for the workplace and the community.</p>
</div>
<div class="resources-content-container">
<div class="resource-headers">
<div class="resource-header resource-workplace-header resource-header-selected">
<img src="<?php echo get_template_directory_uri();?>/images/icons/iconEmployer.svg" alt="workplace icon">
<h3>Workplace</h3>
<hr class="highlight-bar">
</div>
<div class="resource-header resource-community-header">
<img src="<?php echo get_template_directory_uri();?>/images/icons/IconEmployee -plum 1.52.00 PM.svg" alt="community icon">
<h3>Community</h3>
<hr class="highlight-bar">
</div>
</div>
<section class="workplace-resources">
<div class="parent-cat-container">
<?php
$space = get_category_by_slug( 'workplace' );
$sub_cats = get_categories(array(
'child_of' => $space->term_id,
));
foreach($sub_cats as $sub_cat) : ?>
<h3 class="sub-cat-name"><?php echo $sub_cat->name; ?></h3>
<div class="resource-sub-cat-wrapper">
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'posts_per_page' => 3,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $sub_cat->slug
))
);
$posts = new WP_Query($args);
if ( $posts->have_posts() ) :?>
<?php while($posts->have_posts()) :
$posts->the_post(); ?>
<div class="single-resource">
<a href="<?php the_permalink(); ?>">
<?php if($sub_cat->name === "Videos") : ?>
<div class="video resource-media">
<?php
$content = get_the_content();
$media = get_media_embedded_in_content( $content ); ?>
<?php echo $media[0]; ?>
</div>
<?php elseif(has_post_thumbnail()) : ?>
<div class="resource-media">
<?php the_post_thumbnail(); ?>
</div>
<?php elseif($sub_cat->name === "Audio") : ?>
<div class="audio resource-media">
<img src="<?php echo get_template_directory_uri(); ?>/images/resources/audio-1293262_1280.png" alt="sound waves">
</div>
<?php else : ?>
<div class="logo-placeholder resource-media">
<img src="<?php echo get_template_directory_uri(); ?>/images/icons/vest_logo.png" alt="Vesta logo">
</div>
<?php endif; ?>
<div><?php the_excerpt(); ?></div>
</a>
</div>
<?php endwhile; ?>
</div>
<?php wp_reset_postdata(); ?>
<a href="<?php echo get_category_link($sub_cat->term_id); ?>" class="more-resources-btn">View All <?php echo $sub_cat->name ?></a>
<?php endif; ?>
<?php endforeach; ?>
</div>
</section>
<section class="community-resources parent-cat-container">
<div class="parent-cat-container">
<?php
$space = get_category_by_slug( 'community' );
$sub_cats = get_categories(array(
'child_of' => $space->term_id,
));
foreach($sub_cats as $sub_cat) : ?>
<h3 class="sub-cat-name"><?php echo $sub_cat->name; ?></h3>
<div class="resource-sub-cat-wrapper">
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'posts_per_page' => 3,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'name',
'terms' => $sub_cat->name
))
);
$posts = new WP_Query($args);
if ( $posts->have_posts() ) :?>
<?php while($posts->have_posts()) :
$posts->the_post(); ?>
<div class="single-resource">
<a href="<?php the_permalink(); ?>">
<?php if($sub_cat->name === "Videos") : ?>
<div class="video resource-media">
<?php
$content = get_the_content();
$media = get_media_embedded_in_content( $content ); ?>
<?php echo $media[0]; ?>
</div>
<?php elseif(has_post_thumbnail()) : ?>
<div class="resource-media">
<?php the_post_thumbnail(); ?>
</div>
<?php elseif($sub_cat->name === "Audio") : ?>
<div class="audio resource-media">
<img src="<?php echo get_template_directory_uri(); ?>/images/resources/audio-1293262_1280.png" alt="sound waves">
</div>
<?php else : ?>
<div class="logo-placeholder resource-media">
<img src="<?php echo get_template_directory_uri(); ?>/images/icons/vest_logo.png" alt="Vesta logo">
</div>
<?php endif; ?>
<div><?php the_excerpt(); ?></div>
</a>
</div>
<?php endwhile; ?>
</div>
<?php wp_reset_postdata(); ?>
<a href="<?php echo get_category_link($sub_cat->term_id); ?>" class="more-resources-btn">View All <?php echo $sub_cat->name ?></a>
<?php endif; ?>
<?php endforeach; ?>
</div>
</section>
<section class="suggest-a-resource">
<h4 class="suggestion-header"> Can't find what you're looking for?</h4>
<?php dynamic_sidebar('sidebar-resource-suggest'); ?>
</section>
</div>
</main>
<?php get_footer(); ?>