-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop.php
58 lines (41 loc) · 1.38 KB
/
loop.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
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
if (have_posts()): while (have_posts()) : the_post();
$copy = get_the_content();
$copy = strip_tags($copy);
$copy = preg_replace('/\[.*?\]|/', '', $copy);
$copy = wp_trim_words( $copy, 25, '...' );
?>
<!-- article -->
<article id="post-<?php the_ID(); ?>" <?php post_class('row'); ?>>
<!-- post thumbnail -->
<?php if ( has_post_thumbnail()) {?>
<div class="col s12 m12 l3">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="featureImg mainloop">
<?php the_post_thumbnail('square'); // Declare pixel size you need inside the array ?>
</a>
</div>
<div class="col s12 m12 l9">
<?php } else { ?>
<div class="col s12">
<?php } ?>
<h4>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h4>
<!-- /post title -->
<!-- post details -->
<span class="date">Posted on: <?php the_time('F j, Y'); ?> <?php the_time('g:i a'); ?></span>
<!-- /post details -->
<p><?php echo $copy ?>... </p>
<a href="<?php echo get_permalink( $post->ID ); ?>">Read more</a> <?php edit_post_link(); ?>
</article>
<hr>
<!-- /article -->
<?php endwhile; ?>
<?php else: ?>
<!-- article -->
<article>
<h2><?php _e( "Oh no! We couldn't find any posts...", 'html5blank' ); ?></h2>
</article>
<!-- /article -->
<?php endif; ?>