forked from InfoAmazonia/infocongo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
single.php
154 lines (143 loc) · 5.88 KB
/
single.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php get_header(); ?>
<?php if(have_posts()) : the_post(); ?>
<div id="single-post-map" class="container">
<div class="twelve columns">
<?php get_template_part('stage', 'map'); ?>
</div>
</div>
<article id="single-post">
<section id="content">
<div class="container">
<div class="row post-header">
<div class="twelve columns">
<h1><?php the_title(); ?></h1>
<p class="post-excerpt"><?php the_excerpt(); ?></p>
</div>
</div>
<div class="row post-meta">
<div class="ten offset-by-one columns ">
<div class="one-third column"><span class="icon_pencil"></span>
<span class="info"><b>
<?php echo get_the_date(); ?>
<?php echo get_the_term_list( $post->ID, 'publisher', ' | ', ', ' ); ?>
<?php echo ' <a> | </a>'; ?>
<?php $author_name = the_author_posts_link( $user_id ); echo $author_name; ?>
</b></span></div>
<div class="one-third column"><span class="icon_pin_alt"></span><span class="info"><b><?php echo get_the_term_list( $post->ID, 'country', ' ', ', ' ); ?></b></span></div>
<div class="one-third column"><span class="icon_tag_alt"></span><span class="info"><b><?php echo get_the_term_list( $post->ID, 'topic', ' ', ', ' ); ?></b></span></div>
</div>
</div>
<div class="row ">
<div class="post-content ten offset-by-one columns">
<!-- Show map depending on a variable -->
<?php
// Get the variable show_map.
$show_map = get_post_meta($post->ID, 'show_map', true);
// $show_map value yes, "" or no.
// When is yes o "" show the map.
// When is no not show the map.
if($show_map != 'no'){
?>
<div style="width:100%;height:500px; margin-bottom:40px;">
<?php
global $jeo;
$jeo->get_map(false, false, true);
?>
</div>
<?php
}
?>
<!-- End of map display depending on a variable -->
<?php the_content(); ?>
<?php $value = get_field( "article_url" );
if( $value ) {
echo '<p>Click <a href="' . $value . '">here</a> to read the original article. </p>';
}
?>
<!-- Related Posts //-->
<div class="">
<?php
$orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);
if($tags){
?>
<h2><?php _e('Related posts', 'infocongo'); ?></a></h2>
<ul class="list-posts special">
<?php
$tag_ids = array();
foreach($tags as $individual_tag){
$tag_ids[] = $individual_tag->term_id;
}
$args = array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page' => 3, // Number of related posts to display.
'caller_get_posts' => 1
);
$my_query = new wp_query($args);
while($my_query->have_posts()) {
$my_query->the_post();
?>
<li id="post-<?php the_ID(); ?>" <?php post_class('four columns'); ?>>
<article id="post-<?php the_ID(); ?>">
<section class="post-content">
<?php
if(has_post_thumbnail()) {
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'featured' );
echo '<img src="' . $image_src[0] . '" width="100%" />';
}else{
echo '<div class="nothumb featured"></div>';
}
?>
</section>
<header class="post-header">
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
</header>
</article>
</li>
<?php
}
?>
</ul>
<?php
}
$post = $orig_post;
wp_reset_query();
?>
<div class="twelve columns">
<div class="navigation">
<?php posts_nav_link(); ?>
</div>
</div>
</div>
<?php //echo do_shortcode('[shareaholic app="share_buttons" id="19469300"]'); //share buttons ?>
<?php //rp4wp_children(); //Related posts ?>
<?php
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
</div>
<script type="text/javascript">
var embedUrl = jQuery('.embed-button').attr('href');
var printUrl = jQuery('.print-button').attr('href');
jeo.mapReady(function(map) {
if(map.conf.postID) {
jQuery('.print-button').attr('href', printUrl + '&map_id=' + map.conf.postID + '#print');
jQuery('.embed-button').attr('href', embedUrl + '&map_id=' + map.conf.postID);
}
});
jeo.groupReady(function(group) {
jQuery('.print-button').attr('href', printUrl + '&map_id=' + group.currentMapID + '#print');
jeo.groupChanged(function(group, prevMap) {
jQuery('.print-button').attr('href', printUrl + '&map_id=' + group.currentMapID + '#print');
});
});
</script>
</div>
</div>
</section>
</article>
<?php endif; ?>
<?php get_footer(); ?>