-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patharchive-topic.php
132 lines (112 loc) · 5.68 KB
/
archive-topic.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
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
<?php get_header();
$options = get_option('odm_options');
$date_to_show = isset($options['single_page_date']) ? $options['single_page_date'] : "metadata_created"; ?>
<div class="section-title main-title">
<section class="container">
<header class="row">
<div class="eight columns">
<h1 class="ellipsis"><?php _e('Topics', 'odm') ?></h1>
</div>
<div class="eight columns align-right">
<?php get_template_part('section', 'query-actions'); ?>
</div>
</header>
</section>
<section class="container">
<div class="row">
<div class="sixteen columns filter-container">
<div class="panel more-filters-content row">
<?php
$filter_arg = array(
'search_box' => true,
'cat_selector' => true,
'con_selector' => false,
'date_rang' => true,
'post_type' => get_post_type()
);
odm_adv_nav_filters($filter_arg);
?>
</div>
</div>
</div>
<div class="row">
<div class="sixteen columns">
<?php
$taxonomy_categories_1 = ["agriculture-and-fishing", "disaster-and-emergency-response", "environment-and-natural-resources", "extractive-industries", "land"];
$taxonomy_categories_2 = ["economy-and-commerce", "energy", "industry", "infrastructure", "labor", "science-and-technology"];
$taxonomy_categories_3 = ["aid-and-development", "government", "law-and-judiciary", "population-and-censuses", "social-development", "urban-administration-and-development"];
$sdg = get_term_by('slug', 'sustainable-development-goals', 'category');
if ($sdg) {
$sdg_children = get_terms('category', array('parent' => $sdg->term_id));
$taxonomy_categories_4 = array();
foreach ($sdg_children as $child) {
array_push($taxonomy_categories_4, $child->slug);
}
?>
<h3 class="clearfix"><a href="/topics/sustainable-development-goals"><?php _e($sdg->name, 'odm'); ?></a></h3>
<?php
while (have_posts()) : the_post();
$post = get_post();
$top_level_cat_names = get_top_level_category_slugs(get_the_category($post->ID));
if (arrays_have_common_items($top_level_cat_names, $taxonomy_categories_4)) :
odm_get_template('post-grid-single-4-cols', array(
'post' => $post,
'show_meta' => true,
'meta_fields' => array('date'),
'orderby' => 'title',
'order' => 'asc'
), true);
endif;
endwhile;
rewind_posts();
}
?>
<h3 class="clearfix"><?php _e('Environment and land', 'odm'); ?></h3>
<?php
while (have_posts()) : the_post();
$post = get_post();
$top_level_cat_names = get_top_level_category_slugs(get_the_category($post->ID));
if (arrays_have_common_items($top_level_cat_names, $taxonomy_categories_1)) :
odm_get_template('post-grid-single-4-cols', array(
"post" => $post,
"show_meta" => true,
"meta_fields" => array("date"),
"order" => $date_to_show
), true);
endif;
endwhile;
rewind_posts(); ?>
<h3 class="clearfix"><?php _e('Economy and industry', 'odm'); ?></h3>
<?php
while (have_posts()) : the_post();
$post = get_post();
$top_level_cat_names = get_top_level_category_slugs(get_the_category($post->ID));
if (arrays_have_common_items($top_level_cat_names, $taxonomy_categories_2)) :
odm_get_template('post-grid-single-4-cols', array(
"post" => $post,
"show_meta" => true,
"meta_fields" => array("date"),
"order" => $date_to_show
), true);
endif;
endwhile;
rewind_posts(); ?>
<h3 class="clearfix"><?php _e('People and government', 'odm'); ?></h3>
<?php
while (have_posts()) : the_post();
$post = get_post();
$top_level_cat_names = get_top_level_category_slugs(get_the_category($post->ID));
if (arrays_have_common_items($top_level_cat_names, $taxonomy_categories_3)) :
odm_get_template('post-grid-single-4-cols', array(
"post" => $post,
"show_meta" => true,
"meta_fields" => array("date"),
"order" => $date_to_show
), true);
endif;
endwhile; ?>
</div>
</div>
</section>
</div>
<?php get_footer();