-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpage-nossos-cursos.php
More file actions
198 lines (166 loc) · 6.15 KB
/
page-nossos-cursos.php
File metadata and controls
198 lines (166 loc) · 6.15 KB
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(); ?>
<div class="container-header">
<div class="content-header">
<div class="title">
<h1>Nossos cursos</h1>
</div>
</div>
</div>
<div class="container">
<p>Um dos setores de maior destaque no LearningLab é o de cursos. Ao longo da nossa história, já ministramos 7 cursos e impactamos mais de 150 estudantes com eles — 130 deles sendo certificados!</p>
<p>Nessa página, você pode conferir todos os cursos já ministrados pelo LearningLab, bem como os que ainda estão por vir.</p>
<p><strong>Dica útil:</strong> clique ou toque sobre um curso para realizar a inscrição (caso ela esteja aberta) ou visualizar detalhes sobre ele.</p>
<?php
// ========================================
// SEÇÃO: Cursos em andamento
// ========================================
$andamento_args = array(
'post_type' => 'curso',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'status_curso',
'field' => 'slug',
'terms' => 'curso-em-andamento',
),
),
'orderby' => 'date',
'order' => 'DESC',
);
$andamento_query = new WP_Query($andamento_args);
if ($andamento_query->have_posts()) :
?>
<section class="cursos-em-andamento">
<h2>Cursos em andamento</h2>
<div class="cards-grid">
<?php
while ($andamento_query->have_posts()) : $andamento_query->the_post();
$terms = get_the_terms(get_the_ID(), 'status_curso');
$inscricoes_abertas = false;
$inscricoes_encerradas = false;
if ($terms) {
foreach ($terms as $term) {
if ($term->slug === 'inscricoes-abertas') {
$inscricoes_abertas = true;
}
if ($term->slug === 'inscricoes-encerradas') {
$inscricoes_encerradas = true;
}
}
}
if ($inscricoes_abertas) {
$badge_text = 'inscrições abertas';
$badge_class = 'aberto';
} elseif ($inscricoes_encerradas) {
$badge_text = 'inscrições encerradas';
$badge_class = 'encerrado';
} else {
$badge_text = 'em andamento';
$badge_class = 'em-andamento';
}
get_template_part('template-parts/content', 'card', array(
'show_badge' => true,
'badge_text' => $badge_text,
'badge_class' => $badge_class,
));
endwhile;
wp_reset_postdata();
?>
</div>
</section>
<?php endif; ?>
<?php
// ========================================
// SEÇÃO: Cursos futuros
// ========================================
$futuros_args = array(
'post_type' => 'curso',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'status_curso',
'field' => 'slug',
'terms' => 'curso-futuro',
),
),
'orderby' => 'date',
'order' => 'DESC',
);
$futuros_query = new WP_Query($futuros_args);
if ($futuros_query->have_posts()) :
?>
<section class="cursos-futuros">
<h2>Cursos futuros</h2>
<div class="cards-grid">
<?php
while ($futuros_query->have_posts()) : $futuros_query->the_post();
$terms = get_the_terms(get_the_ID(), 'status_curso');
$inscricoes_abertas = false;
$inscricoes_encerradas = false;
if ($terms) {
foreach ($terms as $term) {
if ($term->slug === 'inscricoes-abertas') {
$inscricoes_abertas = true;
}
if ($term->slug === 'inscricoes-encerradas') {
$inscricoes_encerradas = true;
}
}
}
if ($inscricoes_abertas) {
$badge_text = 'inscrições abertas';
$badge_class = 'aberto';
} elseif ($inscricoes_encerradas) {
$badge_text = 'inscrições encerradas';
$badge_class = 'encerrado';
} else {
$badge_text = 'em breve';
$badge_class = 'em-breve';
}
get_template_part('template-parts/content', 'card', array(
'show_badge' => true,
'badge_text' => $badge_text,
'badge_class' => $badge_class,
));
endwhile;
wp_reset_postdata();
?>
</div>
</section>
<?php endif; ?>
<?php
// ========================================
// SEÇÃO: Cursos passados (sempre exibe)
// ========================================
$passados_args = array(
'post_type' => 'curso',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'status_curso',
'field' => 'slug',
'terms' => 'curso-passado',
),
),
'orderby' => 'title',
'order' => 'ASC',
);
$passados_query = new WP_Query($passados_args);
?>
<section class="cursos-passados">
<h2>Cursos passados</h2>
<div class="cards-grid">
<?php
if ($passados_query->have_posts()) :
while ($passados_query->have_posts()) : $passados_query->the_post();
get_template_part('template-parts/content', 'card');
endwhile;
wp_reset_postdata();
else : ?>
<p>Não há cursos passados disponíveis no momento.</p>
<?php endif; ?>
</div>
</section>
</div>
<?php get_footer(); ?>