-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtpl-blog.php
104 lines (82 loc) · 3.06 KB
/
tpl-blog.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
<?php
/*
Template Name: Blog
*/
?>
<?php get_header(); ?>
<div id="content">
<div class="container">
<div class="">
<div id="blog_cont">
<?php
$category_ID = get_category_id('blog');
$args = array(
'post_type' => 'post',
'posts_per_page' => 6,
'cat' => $category_ID,
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1)
);
query_posts($args);
$x = 0;
while (have_posts()) : the_post(); ?>
<div class="home_blog_box">
<?php if(get_post_meta( get_the_ID(), 'page_featured_type', true ) == 'youtube') { ?>
<iframe width="370" height="210" src="http://www.youtube.com/embed/<?php echo get_post_meta( get_the_ID(), 'page_video_id', true ); ?>" frameborder="0" allowfullscreen></iframe>
<?php } elseif(get_post_meta( get_the_ID(), 'page_featured_type', true ) == 'vimeo') { ?>
<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=085e17" width="500" height="338" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<?php } else { ?>
<div class="zoom_img_cont"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('blog-img'); ?></a></div>
<?php } ?>
<div class="clear"></div>
</div> <!-- //home_blog_box -->
<?php $x++; ?>
<?php endwhile; ?>
<div class="clear"></div>
</div><!--//blog_cont-->
<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 / 4); ?></div>
<?php wp_reset_query(); ?>
</div><!--//single_full_cont-->
<div class="clear"></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');
$('#blog_cont').infinitescroll({
navSelector : "div.load_more_text",
nextSelector : "div.load_more_text a:first",
itemSelector : "#blog_cont .home_blog_box",
//behavior: "twitter",
maxPage: <?php echo $max_pages; ?>
},function(arrayOfNewElems){
$('#blog_cont').append('<div class="clear"></div>');
$('.load_more_text a').css('visibility','visible');
curPage++;
if(curPage == pagesNum) {
$('.load_more_text a').css('display','none');
} else {}
});
}
);
</script>
<?php get_footer(); ?>