-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
101 lines (78 loc) · 2.51 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
* The main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link http://codex.wordpress.org/Template_Hierarchy
*
* @package Wordtrap
* @since wordtrap 1.0.0
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
// View mode
$view_mode = wordtrap_get_view_mode();
// Pagination
$pagination = wordtrap_options( 'posts-pagination' );
get_header();
?>
<?php
if ( have_posts() ) :
if ( $pagination ) : ?>
<div class="posts-pagination-container posts-pagination-<?php echo esc_attr( $pagination ) ?>">
<?php
endif;
wordtrap_posts_filter_navigation( 'posts-filter-above' );
if ( $view_mode === 'grid' ) : ?>
<div class="posts-grid posts-view-<?php echo esc_attr( wordtrap_options( 'posts-grid-view' ) ) ?> <?php echo esc_attr( wordtrap_grid_view_classes() ) ?>">
<?php
endif;
$prev_year = null;
$prev_month = null;
$count = 1;
$timeline_view = $view_mode === 'grid' && wordtrap_options( 'posts-grid-view' ) === 'timeline';
// Load posts loop.
while ( have_posts() ) :
the_post();
$timestamp = strtotime( get_the_date() );
$year = get_the_date( 'o' );
$month = date( 'n', $timestamp );
if ( $timeline_view && ( $prev_month != $month || ( $prev_month == $month && $prev_year != $year ) ) ) :
$post_count = 1;
$prev_year = $year;
$prev_month = $month;
?>
<div class="timeline-date"><span><?php echo get_the_date( 'F Y' ); ?></span></div>
<?php endif;
if ( $view_mode === 'grid' ) :
?>
<div class="post-wrap<?php echo $timeline_view ? ( ( 1 == $post_count++ % 2 ? ' left' : ' right' ) ) : '' ?>">
<?php
endif;
get_template_part( 'template-parts/content/content', get_post_format() );
if ( $view_mode === 'grid' ) :
?>
</div><!-- .post-wrap -->
<?php
endif;
endwhile;
if ( $view_mode === 'grid' ) : ?>
</div><!-- .posts-grid -->
<?php
endif;
wordtrap_posts_filter_navigation( 'posts-filter-below' );
if ( $pagination ) : ?>
</div><!-- .posts-pagination-container -->
<?php
endif;
else :
// If no content, include the "No posts found" template.
get_template_part( 'template-parts/content/content', 'none' );
endif;
?>
<?php
get_footer();