-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
front-page.php
134 lines (133 loc) · 4.88 KB
/
front-page.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
<?php
/**
* The front page template file
*
* This is the home page
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package MinnPost Largo
*/
get_header(); ?>
<main id="main" class="site-main m-homepage-zones">
<?php if ( function_exists( 'z_get_zone' ) ) : ?>
<?php $top_query = z_get_zone_query( 'homepage-top' ); ?>
<div id="home-list" class="o-homepage-listing
<?php
if ( $top_query->have_posts() ) :
?>
o-homepage-listing-with-top
<?php
else :
?>
o-homepage-listing-without-top<?php endif; ?>">
<?php if ( $top_query->have_posts() ) : ?>
<?php $post_count = $top_query->post_count; ?>
<section class="m-archive m-archive-top m-archive-has-<?php echo (int) $post_count; ?>-post m-zone m-zone-homepage-top">
<?php do_action( 'wp_message_inserter', 'above_homepage_articles' ); ?>
<?php
while ( $top_query->have_posts() ) :
$top_query->the_post();
get_template_part( 'template-parts/content', 'top' ); // content-top
endwhile;
?>
<?php dynamic_sidebar( 'sidebar-glean' ); ?>
</section>
<?php get_sidebar( 'first' ); ?>
<?php endif; ?>
<?php
$top_stories_zone = 'homepage-more-top-stories';
$top_zone = z_get_zone( $top_stories_zone );
$more_top_stories = z_get_zone_query( $top_stories_zone );
?>
<?php if ( $more_top_stories->have_posts() ) : ?>
<section class="m-archive m-archive-homepage m-zone m-zone-homepage-more-top">
<?php
if ( '' !== $top_zone->description ) {
$top_zone_title = $top_zone->description;
} elseif ( ! $top_query->have_posts() ) {
$top_zone_title = __( 'Top stories', 'minnpost-largo' );
} else {
$top_zone_title = __( 'More top stories', 'minnpost-largo' );
}
$top_zone_title = wptexturize( $top_zone_title );
?>
<?php if ( ! $top_query->have_posts() ) : ?>
<?php do_action( 'wp_message_inserter', 'above_homepage_articles' ); ?>
<?php endif; ?>
<h2 class="a-zone-title"><?php echo $top_zone_title; ?></h2>
<?php
$count = 1;
while ( $more_top_stories->have_posts() ) :
$more_top_stories->the_post();
get_template_part( 'template-parts/content', 'excerpt' );
?>
<?php if ( 2 === $count && ! $top_query->have_posts() ) : ?>
<?php dynamic_sidebar( 'sidebar-glean' ); ?>
<?php endif; ?>
<?php
$count++;
endwhile;
?>
<!--<div class="a-zone-actions">
<a href="<?php echo site_url( '/news/' ); ?>" class="a-button-content"><?php echo __( 'More news', 'minnpost-largo' ); ?></a>
</div>-->
</section>
<?php endif; ?>
<?php if ( ! $top_query->have_posts() ) : ?>
<?php get_sidebar( 'first-and-second' ); ?>
<?php else : ?>
<?php get_sidebar( 'second' ); ?>
<?php endif; ?>
<?php do_action( 'wp_message_inserter', 'homepage_middle' ); ?>
<?php
$sticky_zone_name = 'homepage-sticky';
$sticky_zone = z_get_zone( $sticky_zone_name );
$sticky_query = z_get_zone_query( $sticky_zone_name );
?>
<?php if ( $sticky_query->have_posts() ) : ?>
<?php $sticky_post_count = count( $sticky_query->posts ); ?>
<div class="m-archive m-archive-excerpt m-zone m-zone-homepage-sticky m-zone-homepage-sticky-has-<?php echo (int) $sticky_post_count; ?>">
<h2 class="a-zone-title"><?php echo $sticky_zone->description; ?></h2>
<?php
while ( $sticky_query->have_posts() ) :
$sticky_query->the_post();
get_template_part( 'template-parts/content', 'sticky' ); // content-top
endwhile;
?>
</div>
<?php endif; ?>
<?php
$opinion_zone_name = 'homepage-opinion';
$opinion_zone = z_get_zone( $opinion_zone_name );
$opinion_query = z_get_zone_query( $opinion_zone_name );
?>
<?php if ( $opinion_query->have_posts() ) : ?>
<section class="m-archive m-archive-excerpt m-zone m-zone-homepage-opinion">
<h2 class="a-zone-title"><?php echo $opinion_zone->description; ?></h2>
<?php
while ( $opinion_query->have_posts() ) :
$opinion_query->the_post();
get_template_part( 'template-parts/content', 'opinion' ); // content-excerpt
endwhile;
?>
<!--<div class="a-zone-actions">
<a href="<?php echo site_url( '/opinion/' ); ?>" class="a-button-content"><?php echo __( 'More commentary', 'minnpost-largo' ); ?></a>
</div>-->
</section>
<?php endif; ?>
<?php get_sidebar( 'third' ); ?>
<div class="m-ad-region m-ad-region-home m-ad-region-home-full-width">
<?php do_action( 'acm_tag', 'Middle3' ); ?>
</div>
<div class="m-widget-group m-widget-group-homepage">
<?php dynamic_sidebar( 'sidebar-spills' ); ?>
</div>
<div class="m-widget-group m-widget-group-homepage">
<?php dynamic_sidebar( 'sidebar-membership' ); ?>
</div>
</div>
<?php endif; ?>
</main>
<?php
get_footer();