forked from openknowledge-archive/wordpress-theme-okfn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
events.php
182 lines (153 loc) · 5.1 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
<?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;
}
?>
<? // to use if custom post number is required
global $options;
foreach ($options as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}
if (!empty($okfn_event_posts)) {
$eventPostNumber = $okfn_event_posts;
} else {
$eventPostNumber = '39';
}
?>
<?php get_header() ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $event_content = get_the_content(); ?>
<?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">
<h2 class="pagetitle"><?php the_title(); ?></h2>
</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' => 'Events', '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' => 'Events', '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">
<?
// 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>
<?
global $options;
foreach ($options as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}
if (!empty($okfn_blog_link)) : ?>
<a href="<? echo $okfn_blog_link ?>" class="all-posts">See all posts</a>
<? 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
$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 <? if ($events_category_id != '0') { echo 'Events'; } ?>" />
<? if ($events_category_id != '0') : ?>
<input type="hidden" value="<? echo $events_category_id ?>" name="cat" id="scat" />
<? 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="http://www.meetup.com/OpenKnowledgeFoundation/">
<img src="http://assets.okfn.org/web/images/promo/meetups-285.jpg">
</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>
<?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>