-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
68 lines (57 loc) · 2.01 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
<?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 WordPress
* @subpackage ServicesUOL
* @author Jez Thompson <[email protected]>
* @since 1.0
* @version 1.0
*/
get_header();
$count = 1;
?>
<main id="main" class="site-main">
<?php if ( have_posts() ) : ?>
<div class="row site-module-inner news-padding">
<!-- Loop through all the posts -->
<?php while ( have_posts() ) : the_post(); ?>
<!-- If the post has a thumbnail execute below -->
<?php if(has_post_thumbnail()): ?>
<?php if($count == 2) { echo "</div>"; } ?> <!-- Close off the long post with image on the second loop -->
<div class="item">
<?php get_template_part( 'template-parts/post-listing-index-image' ); ?>
</div> <!-- item -->
<?php $count = 1; ?> <!-- reset the post counter -->
<?php else: //If the count is 1 then it needs to be in a group because it doesn't have an image
if($count == 1) {
echo "<div class='group'>";
}
get_template_part('template-parts/post-listing-index-no_image');
if($count == 2) {
echo "</div>"; //Close off the group
}
$count++; //Increase the counter
if($count > 3) { //Reset the counter if it gets to high
$count = 1;
}
endif; ?>
<?php endwhile; ?>
</div> <!-- row -->
<!-- Pagination for the different results pages -->
<?php the_posts_pagination( array(
'mid_size' => 1,
'prev_text' => __( 'Prev', 'collegeBlog' ),
'next_text' => __( 'Next', 'collegeBlog' ),
) ); ?>
<?php endif; wp_reset_query(); ?>
</div><!-- content-container -->
</main><!-- #main -->
<?php get_footer(); ?>