-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpage-home-blog.php
More file actions
executable file
·94 lines (65 loc) · 2.15 KB
/
Copy pathpage-home-blog.php
File metadata and controls
executable file
·94 lines (65 loc) · 2.15 KB
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
<?php
/**
* Template Name: Homepage blog
* Description: A homepage template for news/blog items with featured item
*
*/
get_header(); ?>
<?php get_template_part( 'parts/posts-header'); ?>
<div class="container frontpage-archive-container">
<div class="row">
<?php
if (term_exists('slider', 'category') ) {
$slider = get_category_by_slug( 'slider' );
$slider_cat = $slider->term_id;
}
$args = array (
'category__not_in' => $slider_cat,
'offset' => '1',
'posts_per_page' => '1',
);
$featured_query = new WP_Query( $args );
if ( $featured_query->have_posts() ) {
while ( $featured_query->have_posts() ) {
$featured_query->the_post(); ?>
<div class="col-md-6 col-sm-12 front-page-featured">
<div class="front-page-post-featured-thumbnail"><?php the_post_thumbnail('large', array( 'class' => 'img-responsive' )); ?></div>
<div class="front-page-post-featured-content">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<span class="front-page-featured-date"><?php echo get_the_date(); ?></span>
<p><?php the_excerpt(); ?></p>
</div>
</div>
<?php }
}
?>
<?php
$args2 = array (
'category__not_in' => $slider_cat,
'offset' => '1',
);
$home_query = new WP_Query( $args2 );
if ( $home_query->have_posts() ) {
while ( $home_query->have_posts() ) {
$home_query->the_post(); ?>
<div class="col-md-3 col-xs-6 front-page-post-item">
<a href="<?php the_permalink(); ?>">
<div class="front-page-post-item-thumbnail"><?php the_post_thumbnail('uu-thumbnail', array( 'class' => 'img-responsive' )); ?></div>
<div class="front-page-post-item-title">
<span class="front-page-post-item-date"><?php echo get_the_date(); ?></span>
<h1><?php the_title(); ?></h1>
</div>
</a>
</div>
<?php }
} else {
// no posts found
} ?>
<?php if ($posts = FALSE) : ?>
<?php get_template_part('includes/template','error'); // WordPress template error message ?>
<?php endif;
wp_reset_postdata();
?>
</div><!-- /row -->
</div> <!-- /container -->
<?php get_footer();