forked from Codeinwp/neve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
210 lines (189 loc) · 5.46 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
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?php
/**
* Index template.
*
* @package Neve
*/
/**
* Filters the container classes.
*
* @param string $classes Container classes.
*
* @since 1.0.0
*/
$container_class = apply_filters( 'neve_container_class_filter', 'container', 'blog-archive' );
get_header();
$wrapper_classes = [ 'posts-wrapper' ];
if ( ! neve_is_new_skin() ) {
$wrapper_classes[] = 'row';
}
?>
<div class="<?php echo esc_attr( $container_class ); ?> archive-container">
<div class="row">
<?php
/**
* Executes the rendering function for the sidebar.
*
* @param string $context Sidebar context.
* @param string $position Sidebar position.
*
* @since 1.0.0
*/
do_action( 'neve_do_sidebar', 'blog-archive', 'left' );
?>
<div class="nv-index-posts blog col">
<?php
/**
* Executes actions before the posts loop start.
*
* @since 2.4.0
*/
do_action( 'neve_before_loop' );
/**
* Executes the rendering function for the page header.
*
* @param string $context Header display page.
*
* @since 2.3.10
*/
do_action( 'neve_page_header', 'index' );
/**
* Executes actions before the post loop.
*
* @since 2.3.10
*/
do_action( 'neve_before_posts_loop' );
$current_post_type = get_post_type();
$should_add_hook = ! in_array( $current_post_type, array( 'post', 'page', 'product' ) );
if ( have_posts() ) {
/* Start the Loop. */
echo '<div class="' . esc_attr( join( ' ', $wrapper_classes ) ) . '">';
$pagination_type = get_theme_mod( 'neve_pagination_type', 'number' );
if ( $pagination_type !== 'infinite' ) {
global $wp_query;
$posts_on_current_page = $wp_query->post_count;
$hook_after_post = -1;
if ( $posts_on_current_page >= 2 ) {
$hook_after_post = (int) ceil( $posts_on_current_page / 2 );
}
$post_index = 1;
}
if ( $should_add_hook ) {
/**
* Executes actions before a post loop.
*
* The dynamic portion of the hook name, $current_post_type, refers to the post type slug.
* This hook is not available for the following post types: post, page, product.
*
* Possible action names include:
* - neve_loop_attachment_before
* - neve_loop_acme_product_before
*
* @since 2.11
*/
do_action( 'neve_loop_' . $current_post_type . '_before' );
}
while ( have_posts() ) {
the_post();
if ( $should_add_hook ) {
/**
* Executes actions before a post loop entry.
*
* The dynamic portion of the hook name, $current_post_type, refers to the post type slug.
* This hook is not available for the following post types: post, page, product.
*
* Possible action names include:
* - neve_loop_attachment_entry_before
* - neve_loop_acme_product_entry_before
*
* @since 2.11
*/
do_action( 'neve_loop_' . $current_post_type . '_entry_before' );
}
/**
* Executes actions before rendering the post content.
*
* @since 2.11
*/
do_action( 'neve_loop_entry_before' );
get_template_part( 'template-parts/content', get_post_type() );
if ( $pagination_type !== 'infinite' ) {
if ( $post_index === $hook_after_post && $hook_after_post !== - 1 ) {
/**
* Executes actions in the middle of the loop.
*
* The actions only fires if the pagination is not set as "infinite scroll".
*
* @since 2.3.10
*/
do_action( 'neve_middle_posts_loop' );
}
$post_index ++;
}
/**
* Executes actions after rendering the post content.
*
* @since 2.11
*/
do_action( 'neve_loop_entry_after' );
if ( $should_add_hook ) {
/**
* Executes actions after a post loop entry.
*
* The dynamic portion of the hook name, $current_post_type, refers to the post type slug.
* This hook is not available for the following post types: post, page, product.
*
* Possible action names include:
* - neve_loop_attachment_entry_after
* - neve_loop_acme_product_entry_after
*
* @since 2.11
*/
do_action( 'neve_loop_' . $current_post_type . '_entry_after' );
}
}
echo '</div>';
if ( ! is_singular() ) {
/**
* Executes the rendering function for the pagination.
*
* @param string $context Pagination location context.
*/
do_action( 'neve_do_pagination', 'blog-archive' );
}
} else {
get_template_part( 'template-parts/content', 'none' );
}
?>
<div class="w-100"></div>
<?php
/**
* Executes actions after the post loop.
*
* @since 2.3.10
*/
do_action( 'neve_after_posts_loop' );
if ( $should_add_hook ) {
/**
* Executes actions after a post loop.
*
* The dynamic portion of the hook name, $current_post_type, refers to the post type slug.
* This hook is not available for the following post types: post, page, product.
*
* Possible action names include:
* - neve_loop_attachment_after
* - neve_loop_acme_product_after
*
* @since 2.11
*/
do_action( 'neve_loop_' . $current_post_type . '_after' );
}
?>
</div>
<?php
do_action( 'neve_do_sidebar', 'blog-archive', 'right' );
?>
</div>
</div>
<?php
get_footer();