-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
225 lines (155 loc) · 7.42 KB
/
index.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
<?php get_header(); ?>
<?php global $woo_options; ?>
<div id="content-wrapper">
<div id="slider-content">
<?php
// Featured Video
if ( get_option('woo_slider') != "true" AND get_option('woo_exclude') )
update_option("woo_exclude", "");
if ( !$paged && get_option('woo_slider') == 'true' )
get_template_part('includes/featured' );
?>
<?php
// Exclude stored duplicates
$exclude = get_option('woo_exclude');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array( 'post__not_in' => $exclude,
'paged'=> $paged );
$args['post_type'] = 'woo_video';
$args['posts_per_page'] = $woo_options['woo_recent_posts'];
query_posts($args);
?>
</div>
<div id="sidebar_wrapper">
<?php
/* No idea why we had this
if ( get_post_type() == 'woo_video' ) {
$terms = get_the_terms( $post->ID, 'woo_video_category');
foreach ( $terms as $term ) {
echo $term->name;
}
}*/
?>
<?php get_sidebar(); ?>
</div>
<div id="content-wrap">
<div id="tabs-home">
<ul class="wooTabs">
<li class="latest"><a href="#home-tab-latest"><?php _e( 'Latest Videos', 'woothemes' ); ?></a></li>
<li class="popular"><a href="#home-tab-pop"><?php _e( 'Most Popular', 'woothemes' ); ?></a></li>
<li class="tags"><a href="#home-tab-tags"><?php _e( 'Popular Keywords', 'woothemes' ); ?></a></li>
</ul>
<div class="clear"></div>
<div class="boxes box inside">
<div id="home-tab-latest" class="list">
<?php
$counter = 0;
$args = array(
'post_type' => 'woo_video',
'order' => 'DESC',
'numberposts' => 8
);
$posts = get_posts( $args );
if ( count($posts) ) {
foreach ( $posts as $post ) {
setup_postdata($post);
$counter++;
?>
<div class="post block">
<div class="tab-image-block">
<?php
$args = 'key=image&width=' . $woo_options['woo_thumb_w'] . '&height=' . $woo_options['woo_thumb_h'] . '&class=thumbnail&link=img&return=true&id=' . get_the_ID();
echo '<a href="' . get_permalink( get_the_ID() ) . '" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">' . woo_image_vimeo( $args ) . '</a>';
?>
</div>
<h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span class="date"><?php the_time( get_option( 'date_format' ) ); ?></span>
</div><!-- /.post -->
<?php if($counter % 4 == 0) { ?>
<div class="fix"></div>
<?php } ?>
<?php
} // End WHILE Loop
echo '<div class="fix"></div>';
woo_pagination();
} else {
?>
<div class="post">
<p><?php _e('Sorry, no posts matched your criteria.', 'woothemes'); ?></p>
</div><!-- /.post -->
<?php } // End IF Statement ?>
<div class="clear"></div>
</div><!-- #tab-latest -->
<div id="home-tab-pop" class="list">
<?php
global $post;
$count = 0;
$args = array(
'post_type' => 'woo_video',
'orderby' => 'comment_count',
'order' => 'DESC',
'posts_per_page' => $woo_options['woo_popular_entries']
);
add_filter('pre_get_posts', 'woo_popular_bycomments' );
function woo_popular_bycomments ( $query ) {
$query->set('orderby', 'comment_count');
$query->set('order', 'DESC');
$query->parse_query();
return $query;
} // End woo_popular_bycomments()
$popular = get_posts( $args );
remove_filter('pre_get_posts', 'woo_popular_bycomments' );
foreach($popular as $post) {
setup_postdata($post);
$count++;
?>
<div class="post block">
<div class="tab-image-block">
<?php
$args = 'key=image&width=' . $woo_options['woo_thumb_w'] . '&height=' . $woo_options['woo_thumb_h'] . '&class=thumbnail&link=img&return=true&id=' . get_the_ID();
echo '<a href="' . get_permalink( get_the_ID() ) . '" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">' . woo_image_vimeo( $args ) . '</a>';
?>
</div>
<h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<span class="date"><?php the_time( get_option( 'date_format' ) ); ?></span>
</div><!-- /.post -->
<?php if ( $count == 4 ) { $count = 0; echo '<div class="clear"></div>'; } ?>
<?php } // End FOREACH Loop ?>
<div class="clear"></div>
</div><!-- #tab-pop -->
<div id="home-tab-tags" class="list">
<?php
$tags_to_include = woo_get_tags_by_post_type( 'woo_video' );
$args = array( 'number' => 20, 'smallest' => 12, 'largest' => 28 );
if ( $tags_to_include ) { $args['include'] = $tags_to_include; }
?>
<?php wp_tag_cloud( $args ); ?>
</div><!-- #tab-tags -->
</div><!-- /.boxes -->
</div><!-- /wooTabs -->
</div><!-- #content-wrap -->
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
// UL = .wooTabs
// Tab contents = .inside
var tag_cloud_class = '#tagcloud';
//Fix for tag clouds - unexpected height before .hide()
var tag_cloud_height = jQuery('#tagcloud').height();
jQuery('.inside ul li:last-child').css('border-bottom','0px'); // remove last border-bottom from list in tab content
jQuery('.wooTabs').each(function(){
jQuery(this).children('li').children('a:first').addClass('selected'); // Add .selected class to first tab on load
});
jQuery('.inside > *').hide();
jQuery('.inside > *:first-child').show();
jQuery('.wooTabs li a').click(function(evt){ // Init Click funtion on Tabs
var clicked_tab_ref = jQuery(this).attr('href'); // Strore Href value
jQuery(this).parent().parent().children('li').children('a').removeClass('selected'); //Remove selected from all tabs
jQuery(this).addClass('selected');
jQuery(this).parent().parent().parent().children('.inside').children('*').hide();
jQuery('.inside ' + clicked_tab_ref).fadeIn(500);
evt.preventDefault();
})
})
</script>
<?php get_footer(); ?>