-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcategory.php
More file actions
218 lines (208 loc) · 10.9 KB
/
category.php
File metadata and controls
218 lines (208 loc) · 10.9 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?php
$count =0;
?>
<?php get_header();?>
<main>
<div class="container-fluid caixa-blog p-5">
<div class="container mt-3 mb-5 p-1 p-xl-5">
<h3 class="texto-blog fw-bold">BLOG</h3>
<h1 class="display-5 fw-bold text-white frase-blog">Nosso blog</h1>
</div>
</div>
<!--Ultimos posts-->
<div class="ultimos pb-5" id="ultimas">
<div class="container bolder">
<p>NOSSO BLOG</p>
<h4>Em destaque</h4>
<div class="row mt-5">
<?php $posts = get_posts(array('numberposts' => 3));
foreach($posts as $post):?>
<?php if ( $count == 0 ){
echo '
<div class="col-xl-7 col-lg-7 col-12 primeiro">
';
}?>
<?php if ( $count == 1 ){
echo '
<div class="col-xl-5 col-lg-5 col-md-12 segundo">
';
}?>
<div class="blog-format">
<a href="<?php echo $post->guid;?>">
<div class="banner">
<img class="thumb"
<?php if(!has_post_thumbnail( $post->ID )){
echo "no-thumbnail";
}?>"
src="<?php if(has_post_thumbnail( $post->ID )){
echo get_the_post_thumbnail_url($post->ID);
}
else{
echo get_template_directory_uri()."/assets/images/logo2.svg";
}?>"
alt="Noticia"
>
</div>
<div>
<div class="infos">
<div class="post-info1">
<h6 class="info-categoria"><?php the_category(', ');?></h6>
<div class="data">
<img class="calendario-icon" src="<?php echo get_template_directory_uri(); ?>/assets/icons/icon-calendario.svg" alt="">
<h6 id="data-post">
<?php setlocale(LC_TIME, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Sao_Paulo');
echo strftime('%d/%m/%Y', strtotime($post->post_date));?>
</h6>
</div>
</div>
<h3 class="post-title">
<a class="titulo" href="<?php the_permalink() ?>" >
<h3>
<?php if (strlen($post->post_title) > 45) {
echo substr(the_title($before = '', $after = '', FALSE), 0, 45) . '...'; }
else {
the_title();}
?>
</h3>
</a>
</h3>
</div>
</div>
</a><br>
</div>
<?php if ( $count == 0 or $count == 2 ){
echo '
</div>
';
}?>
<?php
$count+=1;
?>
<?php
endforeach;
?>
</div>
</div>
</div>
<div class="catepost">
<!--Categorias-->
<div id="categorias">
<div class="container">
<div class="bolder pb-5">
<h4 class="mb-5">Categorias</h4>
<section class="row cats">
<div class="categoria-item col-xl-3 col-lg-2 col-md-5 col-sm-5 col-11">
<a href="<?php echo get_home_url() . "/category/geral"?>">
<div class="item1">
<div class="img-item1">
<img class="" src="<?php echo get_template_directory_uri(); ?>/assets/icons/item1.svg" width="100%" alt="">
</div>
<div class="text-item1">
<span class="material-icons-outlined">Geral</span>
<p class="categoria-descricao">As postagens mais recentes</p>
</div>
</div>
</a>
</div>
<div class="categoria-item col-xl-3 col-lg-2 col-md-5 col-sm-5 col-11">
<a href="<?php echo get_home_url() . "/category/informacoes"?>">
<div class="item1">
<div class="img-item1">
<img class="" src="<?php echo get_template_directory_uri(); ?>/assets/icons/icon-informacoes.svg" width="100%" alt="">
</div>
<div class="text-item1">
<span class="material-icons-outlined">Informações</span>
<p class="categoria-descricao">Feedback</p>
</div>
</div>
</a>
</div>
<div class="categoria-item col-xl-3 col-lg-2 col-md-5 col-sm-5 col-11">
<a href="<?php echo get_home_url() . "/category/curiosidades"?>">
<div class="item1">
<div class="img-item1">
<img class="" src="<?php echo get_template_directory_uri(); ?>/assets/icons/icon-curiosidades.svg" width="100%" alt="">
</div>
<div class="text-item1">
<span class="material-icons-outlined">Curiosidades</span>
<p class="categoria-descricao">Artigos</p>
</div>
</div>
</a>
</div>
</section>
</div>
</div>
</div>
<!--Blog-->
<div id="blog">
<div class="container">
<div class="bolder pb-5">
<h1 class="mb-5 title">
<?php
if ( is_category('geral') == true ){
echo 'Geral';
}
elseif ( is_category('informacoes') == true ){
echo 'Informacoes';
}
elseif ( is_category('curiosidades') == true ){
echo 'Curiosidades';
}
?>
</h1>
<div class="posts row">
<?php $query = new WP_Query($wp_query->query_vars);?>
<?php if($query->have_posts()): while($query->have_posts()): $query->the_post();?>
<div class="col-xl-4 col-lg-4 col-md-6 col-12 postagens mt-3">
<a href="<?php echo $post->guid;?>">
<div class="banner">
<img class="thumb last-posts" <?php if(!has_post_thumbnail( $post->ID )){
echo "no-thumbnail";
}?>"
src="<?php if(has_post_thumbnail( $post->ID )){
echo get_the_post_thumbnail_url($post->ID);
}
else{
echo get_template_directory_uri()."/assets/images/logo2.svg";
}?>" alt="Noticia">
</div>
<div class="infos mt-3 mb-3">
<h6><?php the_category(', ');?></h6>
<a href="<?php the_permalink() ?>" >
<h3>
<?php if (strlen($post->post_title) > 45) {
echo substr(the_title($before = '', $after = '', FALSE), 0, 45) . '...'; }
else {
the_title();}
?>
</h3>
</a>
<div class="recent-info">
<img src="<?php echo get_template_directory_uri(); ?>/assets/icons/icon-calendario.svg" alt="">
<h6 class="recent-date">
<?php setlocale(LC_TIME, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Sao_Paulo');
echo strftime('%d/%m/%Y', strtotime($post->post_date));?>
</h6>
</div>
</div>
</a><br>
</div>
<?php endwhile; else:?>
<h3>Postagem não encontrada</h3>
<?php endif; wp_reset_postdata();?>
</div>
<div class="carrossel-posts text-center mt-5 mb-3">
<?php echo paginate_links(array(
'prev_text' => __( 'Anterior' ),
'next_text' => __( 'Próximo' ),
));?>
</div>
</div>
</div>
</div>
</div>
</main>
<?php get_footer();?>