-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-countries.php
95 lines (95 loc) · 3.44 KB
/
page-countries.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
<?php /* Template Name: Country List*/
get_header(); ?>
<div id="page-countries" <?php post_class(''); ?> id="post-<?php the_ID(); ?>">
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div class="row">
<div class="col-md-8">
<h1 id="post-<?php the_ID(); ?>">
<?php the_title();?>
</h1>
</div>
<div class="col-md-4">
<div class="pull-right"><?php do_action('icl_language_selector'); ?></div>
</div>
</div>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php
$args = array(
'post_type' => 'country',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
);
$my_query = new WP_Query($args);
?>
<div class="row">
<div class="col-md-9">
<table class="table table-hover table-condensed">
<thead>
<tr>
<th><?php _e('Countries','globalrec'); ?></th>
<th><?php _e('Law Report Overview','globalrec'); ?></th>
<th><?php _e('Law Report Attachments','globalrec'); ?></th>
<th><?php _e('City reports (Waste Picker interview)','globalrec'); ?></th>
</tr>
</thead>
<tbody>
<?php if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<?php
global $wp_query;
$wp_query->in_the_loop = true;
?>
<?php
$posts_to_exclude = array(24234, 10942, 24237, 20704); //excludes "-" and "not specified" from list by they ID.
if(!in_array($post->ID, $posts_to_exclude)):
?>
<tr>
<td>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Go to <?php the_title_attribute(); ?>">
<?php the_title(); ?></a>
<?php if ( is_user_logged_in() ) { ?><div class="btn btn-xs btn-default"> <?php edit_post_link(__('Edit This')); ?></div> <?php } ?>
</td>
<td>
<?php
$law_reports = get_posts( array(
'post_type' => 'law-report',
'meta_key' => '_law_countryselect',
'meta_value' => $post->ID
));
foreach($law_reports as $law_report) {
$content = get_post_field( 'post_content', $law_report->ID);
if ($content !='') {echo '<a href="'.get_permalink($law_report->ID).'"><span class="glyphicon glyphicon-ok"></span></a>';}
}
?>
</td>
<td>
<?php foreach($law_reports as $law_report) {
$downloads = get_post_meta( $law_report->ID, '_law_downloads', true );
if ($downloads) {echo '<a href="'.get_permalink($law_report->ID).'"><span class="glyphicon glyphicon-ok"></span></a>';}
}
?>
</td>
<td>
<?php $city_reports = get_posts( array(
'post_type' => 'city',
'meta_key' => '_city_countryselect',
'meta_value' => $post->ID
));
foreach($city_reports as $city_report) {
$content = get_post_field( 'post_content', $city_report->ID);
//only displays "check" if there is content, that means> there is a Interview city report
if ($content !='') {echo '<a href="'.get_permalink($city_report->ID).'" title="'.get_the_title($city_report->ID).'"><span class="glyphicon glyphicon-ok"></span></a>';}
}?>
</td>
</tr>
<?php endif; ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<?php get_footer(); ?>