forked from IFRS/ps-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.php
More file actions
70 lines (63 loc) · 2.42 KB
/
Copy pathsingle.php
File metadata and controls
70 lines (63 loc) · 2.42 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
<?php get_header(); ?>
<?php the_post(); ?>
<section class="container">
<article class="post">
<h2 class="post__title"><?php the_title(); ?></h2>
<div class="post__content">
<?php
if (has_post_thumbnail()) {
the_post_thumbnail('full', array('class' => 'post__thumb'));
}
?>
<?php the_content(); ?>
<hr>
<div class="row post__meta">
<div class="col-12 col-md-6">
<p class="post__date">Publicado em <?php the_date('d/m/Y'); ?></p>
</div>
<div class="col-12 col-md-6">
<?php $cats = get_the_category(); ?>
<?php if (!empty($cats)) : ?>
<ul class="post__categories">
<?php foreach ($cats as $key => $cat) : ?>
<li><a href="<?php echo get_category_link( $cat->term_id ); ?>"><?php echo $cat->name; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
</article>
<?php
// Outros posts das mesmas categorias.
global $post;
$cat_ID = array();
$categories = get_the_category();
foreach ($categories as $category) {
array_push($cat_ID, $category->cat_ID);
}
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'post',
'numberposts' => 5,
'post__not_in' => array($post->ID),
'category__in' => $cat_ID,
);
$cat_posts = get_posts($args);
?>
<?php if (!empty($cat_posts)) : ?>
<aside class="aside">
<h3 class="aside__title">Outros Avisos</h3>
<div class="aside__content">
<?php foreach ($cat_posts as $cat_post) : ?>
<div class="aside__item">
<h4 class="aside__item-title"><a href="<?php echo get_permalink($cat_post); ?>" rel="bookmark"><?php echo $cat_post->post_title; ?></a></h4>
<p class="aside__item-meta"><?php echo get_the_date('d/m/Y', $cat_post->ID); ?></p>
</div>
<?php endforeach; ?>
</div>
</aside>
<?php endif; ?>
</section>
<?php get_footer(); ?>