-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop-post.php
More file actions
39 lines (34 loc) · 1.31 KB
/
loop-post.php
File metadata and controls
39 lines (34 loc) · 1.31 KB
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
<?php
$cats = wp_get_post_categories(get_the_id(), array('fields' => 'id=>name'));
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('col-12 col-md-6 col-lg-4 mb-3'); ?>>
<div class="card h-100">
<?php if(has_post_thumbnail()) : ?>
<?php the_post_thumbnail( 'horz-thumbnail-lg', array('class' => 'card-img-top loop-card') ); ?>
<?php endif; ?>
<div class="card-body">
<span class="posted-date mb-2">
<small class="text-muted">
<time datetime="<?php echo get_the_date(); ?>"><?php echo get_the_date(); ?></time>
</small>
</span>
<h3 class="section-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h3>
<?php
if(count($cats) > 0) :
echo '<div class="categories mb-2 w-100">';
foreach ($cats as $key => $cat) :
echo '<a href="' . get_term_link($key, 'category') . '" class="small text-muted pr-2" title="' . $cat . '">' . $cat . '</a>';
if(next($cats)) :
echo ' | ';
endif;
endforeach;
echo '</div>';
endif;
the_excerpt();
?>
</div>
<a href="<?php the_permalink(); ?>" class="btn btn-block btn-default m-2">Read More <i class="far fa-long-arrow-right"></i></a>
</div>
</article>