-
Notifications
You must be signed in to change notification settings - Fork 20
/
events.php
220 lines (187 loc) · 6.35 KB
/
events.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
<?php
/*
Template Name: Events
*/
/* body class="magazine" */
add_filter('body_class','browser_body_class');
function browser_body_class($classes = '') {
array_push($classes,"magazine events");
return $classes;
}
// Get options
global $options;
foreach ($options as $value) {
if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_option( $value['id'] ); }
}
// to use if custom post number is required
if (!empty($okfn_event_posts)) {
$eventPostNumber = $okfn_event_posts;
} else {
$eventPostNumber = '39';
}
// to use if custom category is required
if (!empty($okfn_events_featured)) {
$featured_cat = $okfn_events_featured;
} else {
$featured_cat = 'Events';
}
?>
<?php get_header() ?>
<div class="row">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $event_content = get_the_content(); ?>
<?php $featured_event_image = get_the_post_thumbnail($page->ID, 'full'); ?>
<?php
global $post;
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
if ($thumbnail_image && isset($thumbnail_image[0])) {
$featured_event_link = $thumbnail_image[0]->post_excerpt;
}
else $featured_event_link = '#';
?>
<?php // get custom field named GCID
if (get_post_meta($post->ID,'GCEID')) {
$gceid = get_post_meta($post->ID,'GCEID', true);
} else {
$gceid = 'notset';
}
?>
<?php endwhile; endif; ?>
<?php // if GCEID is valid use for calendar ID, else use 1
if (is_numeric ($gceid)) {
$calendar_id = $gceid;
} else {
$calendar_id = '1';
} ;
?>
<div class="span12">
<h1 class="pagetitle"><?php the_title(); ?></h1>
</div>
</div>
<div class="row">
<div id="content" class="span8">
<div class="padder">
<?php do_action( 'bp_before_blog_home' ) ?>
<?php do_action( 'template_notices' ) ?>
<div class="page" id="blog-latest" role="main">
<?php
/* =================== */
/* == Magazine Body == */
/* =================== */
if (switch_to_blog(37,true)) {
$post_filter_main = array('category_name' => $featured_cat, 'posts_per_page' => 1 );
$idsToSkip = array();
// Print the main post
query_posts( $post_filter_main );
if (have_posts()) {
the_post();
echo_magazine_post($post, true);
// Skip that post's ID in the remining section
array_push($idsToSkip, $post->ID);
}
// Query remaining posts
$post_filter_etc = array('category_name' => $featured_cat, 'posts_per_page' => $eventPostNumber, 'post__not_in' => $idsToSkip);
$counter = 1; ?>
<div id="magCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="item active">
<?php // Print the remaining posts
query_posts( $post_filter_etc );
while (have_posts()) {
the_post();
echo_magazine_post($post, false);
if ($counter % 4 == 0) : ?>
</div>
<div class="item">
<?php endif;
$counter += 1;
}
/* =================== */
?>
</div><!-- close item -->
</div>
<div class="blog-nav">
<a class="carousel-control left" href="#magCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#magCarousel" data-slide="next">›</a>
<?php global $options;
foreach ($options as $value) {
if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_option( $value['id'] ); }
}
if (!empty($okfn_blog_link)) : ?>
<a href="<?php echo $okfn_blog_link ?>" class="all-posts">See all posts</a>
<?php endif;
restore_current_blog();
}
?>
</div>
</div>
</div>
<?php do_action( 'bp_after_blog_home' ) ?>
</div><!-- .padder -->
</div><!-- #content -->
<div id="sidebar" class="span4" role="complementary">
<?php if (!empty($featured_event_image)) { ?>
<div class="widget widget_text">
<div class="textwidget">
<a class="full" target="_blank" href="<?php echo $featured_event_link; ?>">
<?php echo $featured_event_image; ?>
</a>
</div>
</div>
<?php } ?>
<?php
$events_category_id = get_cat_ID('Events');
?>
<div class="widget widget_search">
<h3 class="widgettitle">Search</h3>
<form method="get" id="search form" action="<?php bloginfo('siteurl'); ?>">
<div>
<input type="text" value="" name="s" id="s" placeholder="Search <?php if ($events_category_id != '0') { echo 'Events'; } ?>" />
<?php if ($events_category_id != '0') : ?>
<input type="hidden" value="<?php echo $events_category_id ?>" name="cat" id="scat" />
<?php endif ?>
<input type="submit" id="search_submit" name="Search" value="Search"/>
</div>
</form>
</div>
<div class="widget widget_text">
<div class="textwidget">
<a class="full" target="_blank" href="https://www.google.com/calendar/b/2/embed?src=okfn.org_1v0fovp5uh4b3l88qr2c6q74o4@group.calendar.google.com&ctz=Europe/Berlin&gsessionid=6x2dZ-lGClbCnUtmhuaDeA>">
<img src="http://assets.okfn.org/web/images/promo/okf-events.png">
</a>
</div>
</div>
<div class="widget widget_text">
<div class="textwidget">
<a class="full" target="_blank" href="http://www.meetup.com/OpenKnowledgeFoundation/">
<img src="http://assets.okfn.org/web/images/promo/local-events.png">
</a>
</div>
</div>
<!--
<div class="widget widget_gce_widget">
<h3 class="widgettitle">Calendar</h3>
<?php //echo do_shortcode( '[google-calendar-events id="'.$calendar_id.'" type="ajax" title="Events on"]' ); ?>
</div>
-->
<div class="sidebar-content">
<?php echo $event_content; ?>
</div>
</div>
<?php //get_sidebar() ?>
</div>
</div>
<?php get_footer() ?>
<script>
jQuery("#magCarousel").carousel({ interval: false });
jQuery(document).ready(function() {
jQuery(".magazine .post.preview .text").dotdotdot({
// configuration goes here
});
});
jQuery('#magCarousel').bind('slid', function() {
jQuery(".magazine .post.preview .text").trigger("update");
});
</script>