-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsidebar.php
More file actions
111 lines (109 loc) · 3.53 KB
/
sidebar.php
File metadata and controls
111 lines (109 loc) · 3.53 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
<?php
/** FRONT PAGE: HIGHLIGHTS **/
if ( is_front_page() || is_home() ) : ?>
<div id="tagcloud">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<?php wp_tag_cloud(); ?>
</div>
</div>
</div>
</div>
<div id="highlights">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-7 col-xs-12" id="latest-data">
<h2>Latest Data and Reports</h2>
<hr>
<ul>
<?php
$args = array( 'numberposts' => 5, 'offset'=> 0, 'category_and' => array(3,18) );
$args = array_merge ($args, mki_orderby_args());
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php include 'entry-meta.php'; ?>
<?php include 'entry-summary.php'; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="col-lg-6 col-md-6 col-sm-5 col-xs-12" id="latest-news">
<h2>Latest News</h2>
<hr>
<?php
$args = array( 'numberposts' => 5, 'offset'=> 0, 'order'=> 'DESC', 'orderby'=> 'date', 'cat' => 8 );
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post); ?>
<article>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<?php include 'entry-meta.php'; ?>
<?php include 'entry-summary.php'; ?>
</article>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
<?php else: ?>
<?php
global $post;
if(!$post) {
// 404 page
return;
}
$post_slug=$post->post_name;
$args = array( 'numberposts' => 10, 'offset'=> 0, 'category_name' => $post_slug );
// if($post_slug == 'data'){
// $args['meta_query'] = array(
// 'relation' => 'OR',
// 'years_not' => array(
// 'key' => 'years',
// 'compare' => 'NOT EXISTS'
// ),
// 'years' => array(
// 'key' => 'years',
// 'type' => 'NUMERIC',
// 'compare' => 'EXISTS'
// ),
// );
// $args['orderby'] = array('meta_value_num'=>'DESC','date'=>'DESC');
// }else{
// $args['orderby'] = 'date';
// }
$postslist = get_posts( $args );
if (count($postslist)!=0){
?>
<!-- SHOW HIGHLIGHTS FOOTER -->
<div id="highlights">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="resources">
<?php if (strcmp($post_slug, "data")===0) { ?>
<h2>Latest Datasets</h2>
<?php } else if (strcmp($post_slug, "news")===0) { ?>
<h2>Latest News</h2>
<?php } else if (strcmp($post_slug, "report")===0) { ?>
<h2>Latest Reports</h2>
<?php } else { ?>
<h2>Latest resources in the category <?php echo $post_slug; ?></h2>
<?php } ?>
<hr>
<ul>
<?php
foreach ($postslist as $post) : setup_postdata($post); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<?php include 'entry-meta.php'; ?>
<?php include 'entry-summary.php'; ?>
</li>
<?php endforeach; ?>
<li><a style="float: right;" href="http://mkinsight.org/category/<?php echo $post_slug; ?>">More...</a></li>
</ul>
</div>
</div>
</div>
</div>
<?php } ?>
<?php endif; ?>