This repository has been archived by the owner on Dec 31, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop-home.php
80 lines (62 loc) · 2.36 KB
/
loop-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
<?php
/**
* The loop that displays posts.
*
* The loop displays the posts and the post content. See
* http://codex.wordpress.org/The_Loop to understand it and
* http://codex.wordpress.org/Template_Tags to understand
* the tags used in it.
*
* This can be overridden in child themes with loop.php or
* loop-template.php, where 'template' is the loop context
* requested by a template. For example, loop-index.php would
* be used if it exists and we ask for the loop with:
* <code>get_template_part( 'loop', 'index' );</code>
*
* @package WordPress
* @subpackage RVB
*/
$site_options = get_option('rvb_site_options');
$featured_count = ( $site_options['general_homefeaturedcount'] ) ? $site_options['general_homefeaturedcount'] : 2;
$summary_count = ( $site_options['general_homesummarycount'] ) ? $site_options['general_homesummarycount'] : 5;
$page_count = ( is_home() ) ? $featured_count + $summary_count : get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$wp_query = new WP_Query( array(
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array('post-format-status'),
'operator' => 'NOT IN'
)
),
'posts_per_page' => $page_count,
'paged' => $paged
) );
if ( $wp_query->have_posts() ) :
$key = 0;
while ( $wp_query->have_posts() ) : $wp_query->the_post();
if ( is_home() && $key < $featured_count ):
get_template_part( 'content', 'featured' );
else :
get_template_part( 'content', 'summary' );
endif; // $key < $featured_count
$key++;
endwhile;
echo '<a class="archives-link" href="'.get_permalink(get_page_by_path('arkiv')).'" title="'.__('More in the archives', 'rvb').'">'.__('More in the archives', 'rvb').'</a>';
else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Uh oh!', 'synack' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'We could not find what you were looking for. Try performing a search.', 'synack' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
<?php if ( is_home() ) : ?>
<aside id="social" role="complementary">
<?php get_sidebar('home2'); ?>
</aside><!-- #social -->
<?php endif; ?>