-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.php
86 lines (78 loc) · 3.88 KB
/
archive.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
<?php get_header(); ?>
<div id="content">
<div class="container">
<?php if(is_category()) { ?>
<div class="archive_title">
<?php printf( __( '%s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' ); ?>
<div class="clear"></div>
</div><!--//archive_title-->
<?php } ?>
<div id="the_mason">
<div class="max_cont">
<?php
global $wp_query;
$args = array_merge( $wp_query->query, array( 'posts_per_page' => 21 ) );
query_posts( $args );
$x = 1;
while (have_posts()) : the_post(); ?>
<div class="home_post_thumb <?php if($x % 3 == 0) { echo 'home_post_thumb_last'; } ?>">
<?php if(get_post_meta( get_the_ID(), 'page_featured_type', true ) == 'youtube') { ?>
<div class="vid_cont"><iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo get_post_meta( get_the_ID(), 'page_video_id', true ); ?>" frameborder="0" allowfullscreen></iframe></div>
<?php } elseif(get_post_meta( get_the_ID(), 'page_featured_type', true ) == 'vimeo') { ?>
<div class="vid_cont"><iframe src="http://player.vimeo.com/video/<?php echo get_post_meta( get_the_ID(), 'page_video_id', true ); ?>?title=0&byline=0&portrait=0&color=02eaff" width="500" height="338" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
<?php } else { ?>
<a class="img" href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('home-image'); ?>
</a>
<?php } ?>
</div>
<?php $x++; endwhile; ?>
</div><!--//max_cont-->
</div> <!--//the_mason -->
<div class="clear"></div>
<div class="load_more_cont">
<div align="center"><div class="load_more_text">
<?php
ob_start();
next_posts_link('LOAD MORE');
$buffer = ob_get_contents();
ob_end_clean();
if(!empty($buffer)) echo $buffer;
?>
</div></div>
</div><!--//load_more_cont-->
<?php
global $wp_query;
$max_pages = $wp_query->max_num_pages;
?>
<div id="max_pages_id" style="display: none;"><?php echo ceil($wp_query->found_posts / 24); //echo $max_pages-1; ?></div>
</div><!--//container-->
</div><!--//content-->
<script type="text/javascript">
$(document).ready(
function($){
var curPage = 1;
var pagesNum = $("#max_pages_id").html(); // Number of pages
if(pagesNum == 1)
$('.load_more_text a').css('display','none');
$('#the_mason').infinitescroll({
navSelector : "div.load_more_text",
// selector for the paged navigation (it will be hidden)
nextSelector : "div.load_more_text a:first",
// selector for the NEXT link (to page 2)
itemSelector : "#the_mason .home_post_thumb",
// selector for all items you'll retrieve
behavior: "twitter",
maxPage: <?php echo $max_pages; ?>
},function(arrayOfNewElems){
$('#the_mason').masonry( 'appended', arrayOfNewElems );
$('.load_more_text a').css('visibility','visible');
curPage++;
if(curPage == pagesNum) {
$('.load_more_text a').css('display','none');
} else {}
});
}
);
</script>
<?php get_footer(); ?>