-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·83 lines (64 loc) · 1.95 KB
/
index.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
<?php
/*
Home/catch-all template
*/
get_header();
// do the page header
page_header( 'Ripon News', get_bloginfo( 'template_url' ) . '/img/bg-header-news.webp', get_snippet( 'header-news' ) );
// parse the query string
$request = parse_query_string();
// lets globalize the wp_query var
global $wp_query, $paged;
// set the args based on current query
$args = $wp_query->query_vars;
// calculate results range to show above the result listing
if ( $paged > 0 ) {
$result_range_start = ( ( $paged - 1 ) * $args['posts_per_page'] ) + 1;
$result_range_end = ( $result_range_start + ( $args['posts_per_page'] - 1 ) );
if ( $wp_query->found_posts > $result_range_end ) {
$result_range = $result_range_start . ' - ' . $result_range_end;
} else {
$result_range = $result_range_start . ' - ' . $wp_query->found_posts;
}
} else {
if ( $wp_query->found_posts > $args['posts_per_page'] ) {
$result_range = '1 - ' . $args['posts_per_page'];
} else {
$result_range = '1 - ' . $wp_query->found_posts;
}
}
// $args['page'] = ( $paged ? $paged : 1 );
// rerun the query
$query = new WP_Query( $args );
?>
<div class="content-wide">
<h3>Browse by Category</h3>
<p><?php wp_dropdown_categories( array( 'class' => 'quick-category-nav', 'value_field' => 'slug' ) ) ?></p>
<hr />
<div class="quiet total-results">
There are <strong><?php echo $wp_query->found_posts; ?></strong> total posts. Showing results <strong><?php print $result_range; ?></strong>.
</div>
<hr />
<div class="article-cards blog-listing">
<?php
while ( $query->have_posts() ) : $query->the_post();
?>
<div class="entry">
<div class="thumbnail">
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
</div>
<div class="entry-inner">
<h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
</div>
</div>
<?php
endwhile;
?>
</div>
<div class="pagination">
<?php pagination(); ?>
</div>
</div>
<?php
get_footer();