-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathmagazine-front.php
132 lines (117 loc) · 3.67 KB
/
magazine-front.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
<?php
/*
Template Name: Magazine
*/
/* body class="magazine" */
add_filter('body_class','browser_body_class');
function browser_body_class($classes = '') {
array_push($classes,"magazine");
return $classes;
}
// Get options
global $options;
foreach ($options as $value) {
if(array_key_exists('id', $value)) {
if (get_option( $value['id'] ) === FALSE) {
if (array_key_exists('std', $value)) {
$$value['id'] = $value['std'] or NULL;
}
} else {
$$value['id'] = get_option( $value['id'] );
}
}
}
if (!empty($okfn_magazine_posts)) {
$magazinePostNumber = $okfn_magazine_posts;
} else {
$magazinePostNumber = '39';
}
if (!empty($okfn_magazine_featured)) {
$featured_cat = $okfn_magazine_featured;
} else {
$featured_cat = 'Featured';
}
?>
<?php get_header() ?>
<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 == */
/* =================== */
$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('posts_per_page' => $magazinePostNumber, '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(array_key_exists('id', $value)) {
if (get_option( $value['id'] ) === FALSE) {
if (array_key_exists('std', $value)) {
$$value['id'] = $value['std'] or NULL;
}
} 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; ?>
</div>
</div>
</div>
<?php do_action( 'bp_after_blog_home' ) ?>
</div><!-- .padder -->
</div><!-- #content -->
<div id="sidebar" class="span4" role="complementary">
<?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>