-
Notifications
You must be signed in to change notification settings - Fork 13
/
home.php
146 lines (120 loc) · 4.89 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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php get_header(); ?>
<div class="showcase-wrapper">
<div class="container-fluid">
<?php custom_breadcrumbs(); ?>
<div class="navigation-wrapper">
<div class="posts-navigation">
<?php // Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'obf-new' ),
'next_text' => __( 'Next page', 'obf-new' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'obf-new' ) . ' </span>',
) ); ?>
</div>
</div>
<!--first post-->
<?php
$obf_exclude = get_cat_ID('home');
$q = '-'.$obf_exclude;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$query = new WP_query ( array(
'posts_per_page' => 1,
'cat' => $q,
'post_type' => 'post',
'post_status' => 'publish',
) );
if ( $query->have_posts() ) { ?>
<section class="latest-post">
<?php while ( $query->have_posts() ) : $query->the_post();
if ( is_paged() == false ) { ?>
<article id="post-<?php the_ID(); ?>">
<div class="post-display">
<div class="latest-post-wrapper">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(); ?>
<div class="latest-post-content">
<h1>
<?php the_title(); ?>
</h1>
<p class="date"> [
<?php the_date(); ?> ]</p>
<p>
<?php the_excerpt(); ?>
</p>
</div>
</a>
</div>
</div>
</article>
<?php } ?>
<?php endwhile;
rewind_posts();
?>
<?php
wp_reset_postdata(); ?>
</section>
<?php } ?>
<?php
$obf_exclude = get_cat_ID('home');
$q = '-'.$obf_exclude;
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
if ( $paged == 1 ){
$offset=1;
} else{
$offset='';
}
$query = new WP_query ( array(
'paged' => $paged,
'cat' => $q,
'post_type' => 'post',
'post_status' => 'publish',
'offset' => $offset,
'number_of_posts' => 15,
) );
if ( $query->have_posts() ) { ?>
<section class="recent-posts grid-container">
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="post-display">
<article>
<div class="recent-post-wrapper">
<div class="recent-post-photo">
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/img/logos/obf-logo.png" alt="<?php the_title(); ?>" />
<?php } ?></a></div>
<div class="recent-post-content">
<a href="<?php the_permalink(); ?>">
<h1>
<?php echo wp_trim_words( get_the_title(), 5 ); ?>
</h1>
<p class="date"> [
<?php the_date(); ?> ]</p>
<p>
<?php the_excerpt(); ?>
</p>
</a>
</div>
</div>
</article>
</div>
<?php endwhile;
rewind_posts(); ?>
<?php
wp_reset_postdata(); ?>
</section>
<?php } ?>
<div class="navigation-wrapper">
<div class="posts-navigation">
<?php // Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'obf-new' ),
'next_text' => __( 'Next page', 'obf-new' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'obf-new' ) . ' </span>',
) ); ?>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>