forked from WPBuddy/largo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.php
76 lines (67 loc) · 2.26 KB
/
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
<?php
/**
* The homepage template
*/
get_header();
/*
* Collect post IDs in each loop so we can avoid duplicating posts
* and get the theme option to determine if this is a two column or three column layout
*/
$ids = array();
$layout = of_get_option('homepage_layout');
$tags = of_get_option ('tag_display');
?>
<div id="content" class="stories span8 <?php echo $layout; ?>" role="main">
<?php if ( $layout === '3col' ) { ?>
<div id="content-main" class="span8">
<?php }
// get the optional homepage top section (if set)
if ( of_get_option('homepage_top') === 'topstories' ) {
get_template_part( 'home-part-topstories' );
} else if ( of_get_option('homepage_top' ) === 'slider') {
get_template_part( 'home-part', 'slider' );
}
// sticky posts box if this site uses it
if ( of_get_option( 'show_sticky_posts' ) ) {
get_template_part( 'home-part', 'sticky-posts' );
}
// bottom section, we'll either use a two-column widget area or a single column list of recent posts
if ( of_get_option( 'homepage_bottom') === 'widgets' ) {
get_template_part( 'home-part', 'bottom-widget-area' );
} else {
$args = array(
'paged' => $paged,
'post_status' => 'publish',
'posts_per_page'=> of_get_option('num_posts_home', 10),
'post__not_in' => $ids,
'ignore_sticky_posts' => true
);
if ( of_get_option('cats_home') )
$args['cat'] = of_get_option('cats_home');
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) : $query->the_post();
//if the post is in the array of post IDs already on this page, skip it
if ( in_array( get_the_ID(), $ids ) ) {
continue;
} else {
$ids[] = get_the_ID();
get_template_part( 'content', 'home' );
}
endwhile;
largo_content_nav( 'nav-below' );
} else {
get_template_part( 'content', 'not-found' );
}
}
if ( $layout === '3col' ) { ?>
</div>
<div id="left-rail" class="span4">
<?php if ( ! dynamic_sidebar( 'homepage-left-rail' ) ) : ?>
<p><?php _e('Please add widgets to this content area in the WordPress admin area under appearance > widgets.', 'largo'); ?></p>
<?php endif; ?>
</div>
<?php } ?>
</div><!-- #content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>