-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
131 lines (93 loc) · 3.52 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
<?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 https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package cap2019
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main container">
<div class="cap-listing__main flex-container">
<div class="cap-listing__posts flex-item">
<header>
<h1 class="page-title"><?php single_post_title(); ?></h1>
<?php
$pdesc = get_field('cap_listing_page_description', get_option('page_for_posts') );
if ( $pdesc && ( '' !== $pdesc ) )
echo "<div class='page-description'>{$pdesc}</div>";
?>
</header>
<?php
if ( have_posts() ) :
$i = 1;
/* Start the Loop */
while ( have_posts() ) :
the_post();
/*
* Include the Post-Type-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Type name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_type() );
if ( ( $i - 7 ) % 28 == 0 ) : cap_blog_inbetween_ad();
elseif ( ( $i - 14 ) % 28 == 0 ) : cap_blog_inbetween_cobus();
elseif ( ( $i - 21 ) % 28 == 0 ) : cap_blog_inbetween_nw();
elseif ( ( $i - 28 ) % 28 == 0 ) : cap_blog_inbetween_stud();
endif;
$i++;
endwhile;
/**
* PAGINATION
* ==========
*/
global $paged, $wp_query;
$paged = ( get_query_var( 'paged' ) )
? absint( get_query_var( 'paged' ) )
: 1;
$total_pages = $wp_query->max_num_pages;
$big = 999999999; // need an unlikely integer
$current_page = max(1, get_query_var('paged'));
$pargs = array(
'prev_text' => '<span class="cap-pagination__prev dashicons dashicons-arrow-left-alt2"></span>',
'next_text' => '<span class="cap-pagination__prev dashicons dashicons-arrow-right-alt2"></span>',
// Using 'type' => 'array' you can remove page links by using unset().
// E.g.: unset( $links[ $total_pages - 7 ] ) - just don't forget to
// set the $total_pages value, see below;
'type' => 'array',
'mid_size' => 1,
'end_size' => 1,
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => $current_page,
'total' => $total_pages,
'paged' => $paged
);
if ($total_pages > 1) :
$links = paginate_links($pargs);
echo '<div class="wrap--cap-pagination"><div class="cap-pagination">';
// Add "Page x of X" info span
echo "<span class='page-numbers pageof-info'>Page {$paged} of {$total_pages}</span>";
foreach ( $links as $link ) echo $link;
echo '</div></div>';
endif;
else :
get_template_part( 'template-parts/content', 'none' );
endif;
?>
</div>
<div class="cap-listing__sidebar flex-item">
<?php get_sidebar('post-archive'); ?>
</div>
</div>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();