-
Notifications
You must be signed in to change notification settings - Fork 324
/
Copy pathpage-home.php
156 lines (99 loc) · 3.23 KB
/
page-home.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
<?php get_header(); ?>
<div class="row">
<div class="col-xs-12">
<div id="awesome-carousel" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<?php
$args_cat = array(
'include' => '1, 9, 8'
);
$categories = get_categories($args_cat);
$count = 0;
$bullets = '';
foreach($categories as $category):
$args = array(
'type' => 'post',
'posts_per_page' => 1,
'category__in' => $category->term_id,
'category__not_in' => array( 10 ),
);
$lastBlog = new WP_Query( $args );
if( $lastBlog->have_posts() ):
while( $lastBlog->have_posts() ): $lastBlog->the_post(); ?>
<div class="item <?php if($count == 0): echo 'active'; endif; ?>">
<?php the_post_thumbnail('full'); ?>
<div class="carousel-caption">
<?php the_title( sprintf('<h1 class="entry-title"><a href="%s">', esc_url( get_permalink() ) ),'</a></h1>' ); ?>
<small><?php the_category(' '); ?></small>
</div>
</div>
<?php $bullets .= '<li data-target="#awesome-carousel" data-slide-to="'.$count.'" class="'; ?>
<?php if($count == 0): $bullets .='active'; endif; ?>
<?php $bullets .= '"></li>'; ?>
<?php endwhile;
endif;
wp_reset_postdata();
$count++;
endforeach;
?>
<!-- Indicators -->
<ol class="carousel-indicators">
<?php echo $bullets; ?>
</ol>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#awesome-carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#awesome-carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-8">
<?php
if( have_posts() ):
while( have_posts() ): the_post(); ?>
<?php get_template_part('content',get_post_format()); ?>
<?php endwhile;
endif;
//PRINT OTHER 2 POSTS NOT THE FIRST ONE
/*
$args = array(
'type' => 'post',
'posts_per_page' => 2,
'offset' => 1,
);
$lastBlog = new WP_Query($args);
if( $lastBlog->have_posts() ):
while( $lastBlog->have_posts() ): $lastBlog->the_post(); ?>
<?php get_template_part('content',get_post_format()); ?>
<?php endwhile;
endif;
wp_reset_postdata();
*/
?>
<!-- <hr> -->
<?php
//PRINT ONLY TUTORIALS
/*
$lastBlog = new WP_Query('type=post&posts_per_page=-1&category_name=news');
if( $lastBlog->have_posts() ):
while( $lastBlog->have_posts() ): $lastBlog->the_post(); ?>
<?php get_template_part('content',get_post_format()); ?>
<?php endwhile;
endif;
wp_reset_postdata();
*/
?>
</div>
<div class="col-xs-12 col-sm-4">
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>