-
Notifications
You must be signed in to change notification settings - Fork 1
/
page-home.php
284 lines (248 loc) · 7.85 KB
/
page-home.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
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
<?php
/* Template name: Home page */
get_header();
// custom post types info
global $wp_post_types;
// descubre, aprende, haz bands
$band_pts = array("itinerario","badge","actividad","earner");
$band_tits = array("Descubre","Aprende","Haz","Comunidad");
$rombo_classes = array("rombo col-md-2 col-md-offset-2 col-sm-2 col-sm-offset-3","rombo col-md-2 col-sm-2","rombo col-md-2 col-sm-2","rombo col-md-2 col-sm-2");
?>
<div id="top" class="container-full">
<div class="container">
<header class="aligncenter">
<div class="row hair">
<div class="col-md-5 col-md-offset-3 col-sm-4 col-sm-offset-4 col-xs-6 col-xs-offset-3">
<img id="quincem-imago" src="<?php echo QUINCEM_BLOGTHEME; ?>/images/quincem-imago-.png" alt="<?php echo QUINCEM_BLOGNAME. " | " . QUINCEM_BLOGDESC; ?>" />
<h1 class="hideout"><?php echo QUINCEM_BLOGNAME ?></h1>
<div class="hideout"><strong><?php echo QUINCEM_BLOGDESC ?></strong></div>
</div>
</div>
</header>
<section class="aligncenter">
<div class="row hair">
<?php
$rombo_count = 0;
foreach ( $band_pts as $band_pt ) { ?>
<div class="<?php echo $rombo_classes[$rombo_count]; ?>">
<h2 class="rombo-tit quincem-smooth"><a href="#<?php echo $band_pt; ?>"><?php echo $wp_post_types[$band_pt]->labels->parent; ?></a></h2>
<p><small><?php echo $wp_post_types[$band_pt]->description; ?></small></p>
</div>
<?php $rombo_count++;
} ?>
</div>
<div class="row hair">
<div class="col-md-2 col-md-offset-5">
<a class="border-band-white" href="/about">SOBRE</a>
</div>
</div>
<div class="row patrocina">
<div class="col-md-4 col-md-offset-4">
<ul class="list-inline">
<!--<li><a href="http://openbadges.org"><img class="patrocina-sec" src="<?php echo QUINCEM_BLOGTHEME; ?>/images/quincem-mozilla.png" alt="Mozilla Foundation" /></a></li>
<li><a href="http://15muebles.org/"><img class="patrocina-main" src="<?php echo QUINCEM_BLOGTHEME; ?>/images/quincem-15muebles.png" alt="Proyecto 15 muebles" /></a></li>
<li><a href="http://museoreinasofia.es/"><img class="patrocina-sec" src="<?php echo QUINCEM_BLOGTHEME; ?>/images/quincem-mncars.png" alt="Museo Nacional Centro de Arte Reina Sofia" /></a></li>-->
</ul>
</div>
</div>
</section>
</div><!-- .container -->
</div><!-- .container-full -->
<?php
// BEGIN bands loop
$band_count = 0;
foreach ( $band_pts as $band_pt ) {
// pt vars
$band_tit = $wp_post_types[$band_pt]->labels->parent;
$band_subtit = $wp_post_types[$band_pt]->labels->name;
$band_desc = $wp_post_types[$band_pt]->description;
// IF ITINERARIOS OR BADGES
if ( $band_pt != 'actividad' ) {
// BADGES: loop args
if ( $band_pt == 'badge' ) {
$args = array(
'posts_per_page' => -1,
'post_type' => $band_pt,
'post_parent' => 0
);
$badges = get_posts($args);
$not_in = array();
foreach ( $badges as $b ) {
$args = array(
'post_type' => $band_pt,
'post_parent' => $b->ID,
'meta_key' => '_quincem_version',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
$children = get_posts($args);
if ( count($children) == 1 ) { $not_in[] = $b->ID; }
elseif ( count($children) >= 2 ) {
$not_in[] = $b->ID;
$ch_count = 0;
foreach ( $children as $ch ) {
if ( $ch_count != 0 ) { $not_in[] = $ch->ID; }
$ch_count++;
}
}
}
$args = array(
'posts_per_page' => -1,
'post_type' => $band_pt,
'orderby' => 'menu_order title',
'order' => 'ASC',
'post__not_in' => $not_in
);
$tablet_count_pt = 4;
$desktop_count_pt = 6;
} elseif ( $band_pt == 'itinerario' ) {
$args = array(
'posts_per_page' => -1,
'post_type' => $band_pt,
'orderby' => 'menu_order',
'order' => 'ASC',
);
$tablet_count_pt = 3;
$desktop_count_pt = 6;
} elseif ( $band_pt == 'earner' ) {
$args = array(
'posts_per_page' => -1,
'post_type' => $band_pt,
'post_parent' => 0,
'orderby' => 'rand',
);
$tablet_count_pt = 6;
$desktop_count_pt = 12;
}
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) { ?>
<div id="<?php echo $band_pt; ?>" class="container-full">
<div class="container">
<section>
<header class="sec-header row hair">
<div class="col-md-12 col-sm-12">
<div class="sec-tit">
<h2><?php echo $band_tit; ?></h2>
<div class="sec-subtit"><?php echo $band_subtit; ?></div>
</div>
<div class="sec-desc"><p><?php echo $band_desc; ?></p></div>
</div>
</header><!-- .sec-header .row .hair-->
<div class="mosac row hair">
<?php
// BEGIN *THIS* band loop
$tablet_count = 0;
$desktop_count = 0;
while ( $the_query->have_posts() ) : $the_query->the_post();
if ( $tablet_count == $tablet_count_pt ) { $tablet_count = 0; echo '<div class="clearfix visible-sm"></div>'; }
if ( $desktop_count == $desktop_count_pt ) { $desktop_count = 0; echo '<div class="clearfix visible-md visible-lg"></div>'; }
$tablet_count++; $desktop_count++;
include "loop-mosac.php";
endwhile;
// END *THIS* band loop
?>
</div><!-- .mosac .row .hair -->
</section>
</div><!-- .container -->
</div><!-- .container-full -->
<?php } // end if have posts
// ACTIVIDADES
} elseif ( $band_pt == 'actividad' ) {
$current = time();
// future actividades
$act_tits[] = "Actividades programadas";
$act_args[] = array(
'posts_per_page' => -1,
'post_type' => $band_pt,
'orderby' => 'meta_value_num',
'meta_key' => '_quincem_date_begin',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => '_quincem_date_begin',
'value' => $current,
'compare' => '>'
)
)
);
// current actividades
$act_tits[] = "Actividades en curso";
$act_args[] = array(
'posts_per_page' => -1,
'post_type' => $band_pt,
'orderby' => 'meta_value_num',
'meta_key' => '_quincem_date_begin',
'order' => 'ASC',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => '_quincem_date_begin',
'value' => $current,
'compare' => '<'
),
array(
'key' => '_quincem_date_end',
'value' => $current,
'compare' => '>'
)
)
);
// past actividades
$act_tits[] = "Actividades finalizadas";
$act_args[] = array(
'posts_per_page' => -1,
'post_type' => $band_pt,
'orderby' => 'meta_value_num',
'meta_key' => '_quincem_date_begin',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => '_quincem_date_end',
'value' => $current,
'compare' => '<'
)
)
); ?>
<div id="<?php echo $band_pt; ?>" class="container-full">
<div class="container">
<header class="sec-header row hair">
<div class="col-md-12 col-sm-12">
<div class="sec-tit">
<h2><?php echo $band_tit; ?></h2>
</div>
<div class="sec-desc"><p><?php echo $band_desc; ?></p></div>
</div>
</header><!-- .sec-header .row .hair-->
<?php // actividades loops
$act_count = 0;
foreach ( $act_args as $args ) {
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) { ?>
<section>
<div class="row">
<header class="col-md-12 col-sm-12">
<h3 class="sec-part-tit"><?php echo $act_tits[$act_count]; ?></h3>
</header>
</div><!-- .row .hair -->
<div class="mosac row hair">
<?php $tablet_count = 0;
$desktop_count = 0;
while ( $the_query->have_posts() ) : $the_query->the_post();
if ( $tablet_count == 4 ) { $tablet_count = 0; echo '<div class="clearfix visible-sm"></div>'; }
if ( $desktop_count == 6 ) { $desktop_count = 0; echo '<div class="clearfix visible-md visible-lg"></div>'; }
$tablet_count++; $desktop_count++;
include "loop-mosac.php";
endwhile; ?>
</div><!-- .mosac .row .hair -->
</section>
<?php } // end if have posts
$act_count++;
} // end actividades loop ?>
</div><!-- .container -->
</div><!-- .container-full -->
<?php } // END if ACTIVIDADES
$band_count++;
}
// END bands loop
?>
<?php get_footer(); ?>