-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-country.php
130 lines (126 loc) · 4.13 KB
/
single-country.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
<?php get_header(); ?>
<?php
$title = get_the_title();
$post_id = $post->ID;
?>
<div class="container">
<div class="row">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="row">
<div class="col-md-9">
<ul class="breadcrumb">
<li><a href="<?php echo get_permalink(icl_object_id(11179,'page')) ?>"><?php _e('Countries','globalrec'); ?></a></li>
<li><?php echo $title; ?></li>
</ul>
<h1><?php echo $title; ?></h1>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?php
//List of Waste Picker Groups that belong to the Country
$waste_picker_groups = get_posts( array(
'post_type' => 'waste-picker-org',
//'meta_key' => '_wpg_countryselect',
//'meta_value' => $post_id,
'meta_key' => 'country',
'meta_value' => $title,
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'title',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'wpg-member-occupation',
'field' => 'slug',
'terms' => 'waste-pickers',
),
array(
'taxonomy' => 'wpg-member-type',
'field' => 'slug',
'terms' => array('members-are-waste-pickers', 'members-are-waste-picker-organizations'),
'operator' => 'IN',
),
),
));
$result = count($waste_picker_groups);
?>
<h3 class="groups-dashicon"><?php _e('Waste Picker Groups','globalrec'); ?></h3>
<table class="table table-condensed table-hover ">
<thead><tr><th><?php _e('Waste Picker Groups','globalrec'); ?> (<?php echo $result; ?>)</th></tr></thead>
<tbody>
<?php
foreach($waste_picker_groups as $waste_picker_group) {
echo '<tr><td><a href="'.get_permalink($waste_picker_group->ID).'">'.$waste_picker_group->post_title.'</a></td></tr>' ;
}
?>
</tbody>
</table>
</div>
<div class="col-md-4">
<?php //Posts about this Country
$posts = get_posts( array(
'post_type' => 'post',
'meta_key' => '_post_country',
'meta_value' => $post_id,
'posts_per_page' => 15,
));
if ($posts) {?>
<h3 class="document-dashicon"><?php _e('Last updates from','globalrec'); ?> <?php echo $title; ?></h3>
<div class="list-group">
<?php foreach($posts as $post) {
//$published_date = get_post_meta( $post->ID, '_gr_article-date', true );
echo '<a href="'.get_permalink($post->ID).'" class="list-group-item">'.$post->post_title;
echo ' ('. get_the_date("m/Y"). ')</a>';
//echo $published_date != ''? ' ('.$published_date.')</a>' : '</a>';
} ?>
</div><?php
}
wp_reset_query(); ?>
</div>
<div class="col-md-4">
<?php //Law Reports list about this Country
$law_reports = get_posts( array(
'post_type' => 'law-report',
'meta_key' => '_law_countryselect',
'meta_value' => $post_id
));
if ($law_reports) {?>
<h3 class="book-dashicon"><?php _e('Law reports overview','globalrec'); ?></h3>
<?php foreach($law_reports as $law_report) {
echo '<a href="'.get_permalink($law_report->ID).'">'.$law_report->post_title.'</a><br>';
}
$downloads = get_post_meta( $law_report->ID, '_law_downloads', true );
if ($downloads) {
echo '<hr><h4>';
echo _e('Laws','globalrec');
echo '</h4>';
echo $downloads;
}
}?>
<hr>
<?php //City Reports list about this Country
$city_reports = get_posts( array(
'post_type' => 'city',
'meta_key' => '_city_countryselect',
'meta_value' => $post_id,
'posts_per_page' => -1,
'order' => 'ASC'
));
if ($city_reports) {?>
<h3><?php _e('City reports','globalrec'); ?></h3>
<?php foreach($city_reports as $city_report) {
echo '<a href="'.get_permalink($city_report->ID).'">'.$city_report->post_title.'</a><br>' ;
}
}?>
</div>
</div>
</div>
<?php include("share.php")?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php posts_nav_link(' — ', __('« Newer Posts'), __('Older Posts »')); ?>
</div>
<?php get_footer(); ?>
</div>