This repository has been archived by the owner on Jan 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathtemplate-advisories.php
69 lines (60 loc) · 2.15 KB
/
template-advisories.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
<?php /* Template Name: Advisories */
get_header();
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>
<article class="container">
<h1 class="headline-page"><?php the_title(); ?></h1>
<div class="row">
<div class="col-md-4">
<h2>ownCloud server</h2>
<?php
$advisory_terms = get_terms( 'advisory_versions' );
foreach ($advisory_terms as $term) {
$args = array(
'post_type' => 'advisories',
'post_status' => 'publish',
'posts_per_page' => -1,
'order' => 'DESC',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'advisory_platform',
'field' => 'slug',
'terms' => 'owncloud-server',
),
array(
'taxonomy' => 'advisory_versions',
'field' => 'slug',
'terms' => array($term->slug),
'operator' => 'IN'
)
)
);
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
?>
<h3><?php echo $term->name; ?></h3>
<?php
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li><p><a href="' . get_the_permalink() . '"><span class="smallfont">' . get_the_date('n/j/Y') . '</span><br />' . get_the_title() . '</a></p></li>';
}
echo '</ul>';
/* Restore original Post Data */
wp_reset_postdata();
} else {
// no posts found
}
}
?>
</div>
</div>
</article>
<?php
endwhile;
endif;
get_footer();