forked from olefredrik/FoundationPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultisite_front_page.php
382 lines (336 loc) · 14.9 KB
/
multisite_front_page.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
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* e.g., it puts together the home page when no home.php file exists.
*
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy}
*
* @package WordPress
* @subpackage FoundationPress
* @since FoundationPress 1.0.0
*/
get_header(); ?>
<div class="row expanded front-page-teaser">
<div class="welcome-text">
<h1><?php echo get_global_title(); ?></h1>
<?php /* TODO: change following element to p.h1 with newer Foundation */ ?>
<h2 class="entry-text"><?php echo get_option('blog_long_description'); ?></h2>
<p class="text-center">
<a href="#" class="button white-ghost">Mehr erfahren</a>
</p>
</div>
</div>
<?php ### Alert: display the latest published alert based on a custom post type
$args = array(
'post_type' => 'alert',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'post_per_page' => '1'
);
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
$query->the_post();
?>
<div class="row expanded front-page-alert">
<div class="small-12 columns text-center">
<?php the_content(); ?>
</div>
</div>
<?php
/* Restore original Post Data */
wp_reset_postdata();
}
?>
<?php ### Introduction: based on a (separate) page 'initiative' ?>
<div class="row section">
<div class="small-12 columns text-center">
<?php
$page = get_page_by_path('initiative');
if( $page ) {
?>
<h2 class="dark-green"><?php echo get_the_title($page); ?></h2>
<?php
// See https://developer.wordpress.org/reference/functions/the_content/
setup_postdata( $page );
the_content('');
wp_reset_postdata();
}
?>
<p style="margin-top: 2rem;">
<a href="initiative#ziele" class="button green-ghost">Unsere Ziele</a>
<a href="#" class="button blue">Mitglied werden</a>
</p>
</div>
</div>
<?php ### Themen und Arbeitsgruppen: based on network blogs (and pages?) ?>
<div class="row expanded section working-groups" id="arbeitsgruppen">
<h2 class="brown">Themen- und Arbeitsgruppen der Initiative</h2>
<div class="small-up-1 medium-up-2 large-up-3" style="max-width: 990px; margin: 0 auto; display: flex; flex-wrap: wrap;">
<?php
# Please note that restore_current_blog() is only able to restore the blog that was active
# before the current one. Therefore, we need to keep the current blog id, i.e. the id of
# the network's main blog.
$network_id = get_current_blog_id();
$sites = get_sites();
foreach($sites as $site) {
$site = (object)$site;
if($site->blog_id == $network_id) continue;
switch_to_blog($site->blog_id);
?>
<div class="column">
<div class="card">
<div class="image-content">
<a href="<?php echo get_bloginfo('url') ?>" title="<?php echo get_bloginfo(); ?>">
<?php echo wp_get_attachment_image(get_option('blog_cover_image'), [600, 400]); ?>
</a>
</div>
<div class="text-content">
<h3><?php echo get_bloginfo(); ?></h3>
<h4><?php echo get_bloginfo('description'); ?></h4>
<p><?php echo get_option('blog_long_description'); ?></p>
</div>
<p>
<a href="<?php echo get_bloginfo('url') ?>" title="<?php echo get_bloginfo(); ?>">Mehr erfahren ›</a>
</p>
</div>
</div>
<?php
}
# Return to network's main blog.
switch_to_blog($network_id);
?>
<?php # TODO: how to handle Themengruppen und Repair Café ?>
<div class="column">
<div class="card">
<div class="image-content">
<a href="#" title="">
<img src="http://placehold.it/600x400" alt="" />
</a>
</div>
<div class="text-content">
<h3>TG Flüchtlingsarbeit</h3>
<h4>Für unsere neuen Nachbarn</h4>
<p>
Themen: Kleiderkammer, Deutschunterricht, Kontakt Café, Kinderbetreuung usw.
</p>
</div>
<p>
<a href="#" title="TG Flüchtlingsarbeit">Mehr erfahren ›</a>
</p>
</div>
</div>
<div class="column">
<div class="card">
<div class="image-content">
<a href="#" title="">
<img src="http://placehold.it/600x400" alt="" />
</a>
</div>
<div class="text-content">
<h3>Das Repair Café Bonn</h3>
<h4>BürgerInnen helfen BürgerInnen</h4>
<p>
Die ehrenamtlichen Helfer reparieren zusammen mit Ihnen kaputte Gegenstände, die Sie mitbringen.
</p>
</div>
<p>
<a href="#" title="Repair Café Bonn">Mehr erfahren ›</a>
</p>
</div>
</div>
<div class="column">
<div class="card">
<div class="image-content">
<a href="#" title="">
<img src="http://placehold.it/600x400" alt="" />
</a>
</div>
<div class="text-content">
<h3>Eine andere AG oder TG</h3>
<h4>Beschreibung</h4>
<p>
Hier steht der Beschreibungstext für die Arbeits- oder Themengruppe.
</p>
</div>
<p>
<a href="#" title="">Mehr erfahren ›</a>
</p>
</div>
</div>
</div>
<div style="clear: both;">
<p class="text-center">
<a href="#" class="button brown-ghost">Arbeitsgruppen anzeigen</a>
</p>
</div>
</div>
<?php ### Veranstaltungen: based on Events Manager Plugin http://wp-events-plugin.com/ ?>
<div class="row section" id="termine">
<h2 class="blue">
<?php
echo get_the_title(get_page_by_path('veranstaltungen'));
?>
</h2>
<div class="small-up-1 medium-up-2 large-up-3" style="max-width: 990px; margin: 0 auto;">
<?php
$args = array(
'category' => '-7', # Exclude category garden. TODO: this should only exclude Gartenöffnungszeiten and be customizable!
'limit' => 6,
'pagination' => false,
'format' =>
'<div class="column vevent">
<a href="#_EVENTURL" class="url">
<div class="schedule-card">
<div class="calendar-sheet">
<time class="dtstart" datetime="#@Y-#@m-#@d">
<span class="month">#@M.</span>
<span class="day">#@d</span>
</time>
</div>
<div class="schedule-text">
<span class="schedule-location location">#_EVENTTIMES</span>
<!-- <span class="schedule-location location">#_LOCATIONNAME</span> -->
<span class="schedule-title summary">#_EVENTNAME</span>
</div>
</div>
</a>
</div>'
);
# if( EM_Events::count($args) > 0 ) {
echo EM_Events::output($args);
# }
# TODO: this seems to be a bug in events manager!
switch_to_blog($network_id);
?>
</div>
<?php # Gartenöffnungszeiten berechnet aus Gartenevents ?>
<div class="small-12 column callout text-center">
<strong>Gartenöffnungszeiten:</strong><br />
<?php
# print_r( get_garden_opening() );
$events = get_garden_opening();
foreach($events as $days => $times) {
$opening = [];
for($i = 0; $i < count($times); $i+=2) {
array_push($opening, substr($times[$i], 0, -3) . '-' . substr($times[$i+1], 0, -3) . ' Uhr');
}
if($times) {
echo $days . ' ' . join($opening, ', ') . '<br />';
} else {
echo $days . ' geschlossen' . '<br />';
}
}
switch_to_blog($network_id);
?>
<!-- <strong>Gartenöffnungszeiten:</strong><br /> Mi. und Do. 17:00 – 20:00 Uhr<br /> Fr. 14:00 – 20:00 Uhr<br /> Sa. und So 14:00 – 18:00 Uhr<br />
<span style="color: #3adb76;"><strong>Der Garten ist offen</strong></span>
-->
</div>
<div class="columns end">
<p class="text-center">
<a href="veranstaltungen/" class="button blue-ghost">Alle Termine anzeigen</a>
</p>
</div>
</div>
<?php ### Latest Network Blog Posts ?>
<div class="row section" role="main" style="border-top: 1px solid #e2e7e3;">
<h2>Neueste Beiträge</h2>
<!-- <article class="main-content">-->
<article class="small-up-1 medium-up-2" style="max-width: 990px; margin: 0 auto; display: flex; flex-wrap: wrap;">
<?php
$network_id = get_current_blog_id();
$sites = get_sites();
# Display six latest blog entries.
$posts = get_posts_for_sites($sites, 6);
foreach($posts as $post) {
switch_to_blog($post->site_id);
setup_postdata($post);
# Use content.php or content-<post_format>.php to render the post's content.
get_template_part('teaser', get_post_format());
# wp_reset_postdata();
}
switch_to_blog($network_id);
if(empty($posts)) {
get_template_part('content', 'none');
}
?>
</article>
<div class="columns end">
<p class="text-center">
<a href="#" class="button green-ghost">Alle Beiträge anzeigen</a>
</p>
</div>
</div>
<?php
/*
<div class="expanded" style="border-top: 1px solid #e2e7e3;">
<div class="row section" id="News">
<div class="row">
<div class="small-12 columns">
<h2>Neues aus den Arbeitsgruppen</h2>
</div>
</div>
<div class="row">
<div class="small-4 columns">
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
</div>
<div class="small-4 columns">
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
</div>
<div class="small-4 columns">
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
<p>
<small>01.05.2016 | AG-Zwischennutzung</small><br />
<!-- Beitragstitel bitte nach 35 Zeichen mit drei Punkten abkürzen -->
<a href="#" title="">Ein langer Titel eines Blogbeitrags …</a>
</p>
</div>
</div>
</div>
</div>
*/
?>
<?php get_footer(); ?>