This repository has been archived by the owner on Jan 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
executable file
·91 lines (63 loc) · 2.07 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
<?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.
* For example, it puts together the home page when no home.php file exists.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*/
defined( 'ABSPATH' ) || exit;
get_header();
// Check if we have posts.
$have_posts = have_posts() ? true : false;
// Check if featured post is enabled.
$featured_post_enabled = get_theme_mod( 'archive_featured_post', true );
$featured_post_enabled = apply_filters( 'wpex_archive_featured_post', $featured_post_enabled );
if ( is_search() ) {
$featured_post_enabled = false;
} ?>
<div class="wpex-content-area">
<?php
// Display page header.
get_template_part( 'partials/archives/header' ); ?>
<?php
// Featured Post.
if ( $have_posts && $featured_post_enabled ) : ?>
<?php get_template_part( 'partials/archives/featured-post' ); ?>
<?php endif; ?>
<main class="wpex-site-main">
<?php
// Check if posts exist.
if ( $have_posts ) : ?>
<div class="wpex-entries wpex-row wpex-cols-<?php echo sanitize_html_class( wpex_get_loop_columns() ); ?>">
<?php
// Get query.
global $wp_query;
// Get featured post ID.
$featured_post = wpex_get_featured_post( $wp_query );
// Loop through posts.
while ( have_posts() ) : the_post();
// Exclude featured post.
if ( $featured_post == get_the_ID() && $featured_post_enabled ) {
continue;
}
// Display post entry.
get_template_part( 'partials/layout-entry' );
// End loop
endwhile; ?>
</div><!-- .wpex-entries -->
<?php
// Include pagination template part.
wpex_include_template( 'partials/global/pagination.php' ); ?>
<?php
// Display no posts found message.
else : ?>
<?php get_template_part( 'partials/entry/none' ); ?>
<?php endif; ?>
</main><!-- .wpex-main -->
</div><!-- .wpex-content-area -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>