-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsingle-curso.php
54 lines (47 loc) · 1.7 KB
/
single-curso.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
<?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 echo get_template_part( 'partials/cursos/curso' ); ?>
</div>
</article>
<?php
// Outros cursos do mesmo Campus.
global $post;
$camp_slug = array();
$campus = get_the_terms(get_the_ID(), 'campus');
foreach ($campus as $camp) {
array_push($camp_slug, $camp->slug);
}
$args = array(
'orderby' => 'date',
'order' => 'DESC',
'post_type' => 'curso',
'numberposts' => -1,
'post__not_in' => array($post->ID),
'tax_query' => array(
array(
'taxonomy' => 'campus',
'field' => 'slug',
'terms' => $camp_slug,
),
),
);
$cat_posts = get_posts($args);
?>
<?php if (!empty($cat_posts)) : ?>
<aside class="aside">
<h3 class="aside__title">Outros Cursos do mesmo Campus</h3>
<div class="aside__content">
<?php foreach ($cat_posts as $cat_post) : ?>
<div class="aside__item">
<h3 class="aside__item-title"><a href="<?php echo get_permalink($cat_post); ?>" rel="bookmark"><?php echo $cat_post->post_title; ?></a></h3>
</div>
<?php endforeach; ?>
</div>
</aside>
<?php endif; ?>
</section>
<?php get_footer(); ?>