-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.php
More file actions
327 lines (267 loc) · 12.2 KB
/
single.php
File metadata and controls
327 lines (267 loc) · 12.2 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<?php get_header(); ?>
<main role="main">
<!-- Articulo Principal -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header>
<?php if ( get_post_type() == 'concejal' ): ?>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="title-description">
<?php the_title( '<h1>', '</h1>' ); ?>
<hr>
</div>
</div>
</div>
</div>
<?php else: ?>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="title-description">
<?php the_title( '<h1>', '</h1>' ); ?>
<hr>
</div>
</div>
</div>
</div>
<?php endif ?>
</header>
<section class="content_format">
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<?php while ( have_posts() ) :
the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
// get_template_part( 'content', get_post_format() );
// Previous/next post navigation.
the_content();
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
comments_template();
}
endwhile;
if ( get_post_type() == 'concejal' ) :
?>
<div class="row">
<div class="col-md-6">
<?php
$fb = get_post_meta( get_the_ID(), 'facebook_concejal', true );
if ( $fb ):
?>
<div class="fb-page"
data-href="<?php echo $fb; ?>"
data-tabs="timeline" data-height="340" data-small-header="false"
data-adapt-container-width="true" data-hide-cover="false"
data-show-facepile="true">
<blockquote cite="<?php echo $fb; ?>"
class="fb-xfbml-parse-ignore"><a
href="<?php echo $fb; ?>">Facebook</a></blockquote>
</div>
<?php
endif;
?>
</div>
<div class="col-md-6">
<?php
$tw = get_post_meta( get_the_ID(), 'twitter_concejal', true );
if ( $tw ):
?>
<a class="twitter-timeline"
data-height="360"
data-link-color="<?php echo get_theme_mod( 'primary_color' ); ?>"
href="<?php echo $tw; ?>?ref_src=twsrc%5Etfw">Tweets</a>
<script async src="https://platform.twitter.com/widgets.js"
charset="utf-8"></script>
<?php
endif;
?>
</div>
<div class="col-md-12 text-center">
<h5>Seguí sus Redes sociales</h5>
<?php $ig = get_post_meta( get_the_ID(), 'instagram_concejal', true ); ?>
<?php $yt = get_post_meta( get_the_ID(), 'youtube_concejal', true ); ?>
<div>
<ul class="list-inline">
<li><a target="_blank" href="<?php echo $fb; ?>"><i
class="fa fa-facebook"></i></a></li>
<li><a target="_blank" href="<?php echo $tw; ?>"><i
class="fa fa-twitter "></i></a></li>
<li><a target="_blank" href="<?php echo $ig; ?>"><i
class="fa fa-instagram"></i></a></li>
<li><a target="_blank" href="<?php echo $yt; ?>"><i
class="fa fa-youtube"></i></a></li>
</ul>
</div>
</div>
</div>
<?php
endif;
// check if the repeater field has rows of data
if ( have_rows( 'archivos' ) ):
// loop through the rows of data
while ( have_rows( 'archivos' ) ) : the_row();
// display a sub field value
$file = get_sub_field( 'archivo' );
$url = $file['url'];
$title = $file['title'];
$caption = $file['caption'];
?>
<li>
<?php
// $url = $file['url'];
// $title = $file['title'];
// $caption = $file['caption'];
// $text = get_sub_field('list_item');
// $url = get_sub_field('item_url');
if ( $url ) {
$text = '<a href="' . $url . '" target="_blank">' . $title . '</a>';
}
echo $text;
?>
</li>
<?php
endwhile;
else :
// no rows found
endif;
?>
</div>
</div>
</div>
</section>
</article>
<!-- Noticias Relacionadas/Ultimas -->
<section class="container related-news">
<div class="row">
<div class="col-md-12">
<?php
$post_id = get_the_ID();
$category_id = get_cat_ID( 'Noticias' );
if ( get_post_type() == 'concejal' || get_post_type() == 'comision' ) {
$queryArg['s'] = get_the_title();
}
$titulo = 'Artículos relacionados';
?>
<h2 class="h3 section-title"><?php echo $titulo; ?></h2>
<div class="row panels-row">
<?php
// $categories = get_the_category( $post_id );
if ( $category_id ) {
// $category_ids = array();
// foreach ( $categories as $individual_category ) {
// $category_ids[] = $individual_category->term_id;
// }
$args = [
'category__in' => [ $category_id ],
'post__not_in' => [ $post_id ],
'posts_per_page' => 4, // Number of related posts that will be shown.
'caller_get_posts' => 1
];
if ( isset( $queryArg ) ) {
$args['s'] = $queryArg['s'];
}
$my_query = new wp_query( $args );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post();
?>
<div class="col-md-3">
<a href="<?php the_permalink() ?>" rel="bookmark"
title="<?php the_title(); ?>"
class="panel panel-default">
<?php if ( has_post_thumbnail() ) { ?>
<div class="panel-heading"
style="background-image:url('<?php the_post_thumbnail_url( 'medium_large' ); ?>');"></div>
<?php } else { ?>
<div class="panel-heading"
style="background-image:url('<?php echo get_stylesheet_directory_uri(); ?>/images/placeholder.png');"></div>
<?php } ?>
<header class="panel-body">
<time class="text-muted"><?php the_time( 'd/m/Y' ) ?></time>
<h3><?php the_title(); ?></h3>
</header>
</a>
</div>
<?php
}
}
}
wp_reset_query();
?>
</div>
</div>
</div>
</section>
<!-- tipos de post relacionados (concejales/comisiones) -->
<?php if ( get_post_type() == 'concejal' || get_post_type() == 'comision' ) : ?>
<section class="container related-news">
<?php
$titulo = ucfirst( get_post_type() ) . 'es';
$argConcejal = get_posts( array(
'category__in' => get_post_type(),
'numberposts' => 5,
'post_type' => 'concejal',
'post__not_in' => array( get_the_ID() )
) );
?>
<h2 class="h3 section-title"><?php echo $titulo; ?></h2>
<div class="row panels-row">
<?php
$related = get_posts( array(
'category__in' => wp_get_post_categories( get_the_ID() ),
'numberposts' => 4,
'post_type' => get_post_type(),
'post__not_in' => array( get_the_ID() )
) );
if ( $related ) {
foreach ( $related as $post ) {
setup_postdata( $post ); ?>
<div class="col-md-3">
<a href="<?php the_permalink() ?>" rel="bookmark"
title="<?php the_title(); ?>"
class="panel panel-default">
<?php if ( has_post_thumbnail() ) { ?>
<div class="panel-heading"
style="background-image:url('<?php the_post_thumbnail_url( 'medium_large' ); ?>');"></div>
<?php } else { ?>
<div class="panel-heading"
style="background-image:url('<?php echo get_stylesheet_directory_uri(); ?>/images/placeholder.png');"></div>
<?php } ?>
<header class="panel-body">
<time class="text-muted"><?php the_time( 'd/m/Y' ) ?></time>
<h3><?php the_title(); ?></h3>
</header>
</a>
</div>
<?php }
}
wp_reset_postdata();
?>
</div>
</section>
<?php endif; ?>
<?php $seccion_destacado_activo = get_theme_mod( 'seccion_destacado_activo' ); ?>
<?php $seccion_destacado_titulo = get_theme_mod( 'seccion_destacado_titulo' ); ?>
<?php $seccion_destacado_boton_texto = get_theme_mod( 'seccion_destacado_boton_texto' ); ?>
<?php $seccion_destacado_boton_url = get_theme_mod( 'seccion_destacado_boton_url' ); ?>
<?php if ( $seccion_destacado_activo ) { ?>
<div class="jumbotron jumbotron-destacado p-t-2">
<div class="row">
<div class="col-md-6">
<p class="text-right"><?php print $seccion_destacado_titulo; ?></p>
</div>
<div class="col-md-6">
<p><a class="btn btn-primary " href="<?php print $seccion_destacado_boton_url; ?>"
role="button"><?php print $seccion_destacado_boton_texto; ?></a></p>
</div>
</div>
</div>
<?php } ?>
</main>
<?php get_footer(); ?>