-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
46 lines (43 loc) · 1.47 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
<?php
/**
* The main template file
*
* Bringing header, content and footer together.
*
* @package WordPress
* @subpackage Thunderblog
* @since 0.0.1
*/
?>
<?php get_header(); ?>
<main>
<section class="featured">
<?php
$sticky = get_option( 'sticky_posts' );
$latest_posts = get_posts( array( 'numberposts' => 1, 'include' => $sticky ) );
$post = count( $latest_posts ) > 0 ? $latest_posts[0] : null;
?>
<?php if ( $post ) : ?>
<article>
<div class="content">
<span class="category"><?php _e( isset( $sticky[0] ) ? 'Featured Post' : 'Latest Post', 'thunderblog' ); ?></span>
<a class="title" href="<?php the_permalink( $post ); ?>">
<h1><?php echo $post->post_title; ?></h1>
</a>
<?php get_template_part( 'parts/post-meta', null, array( 'author' => $post->post_author) ); ?>
<div class="description"><?php the_excerpt( $post ) ?></div>
<a class="btn btn-neutral-light" href="<?php the_permalink( $post ); ?>"><?php _e( 'Read more', 'thunderblog' ); ?></a>
</div>
<?php if ( has_post_thumbnail( $post ) ) : ?>
<img class="d-init-xl" src="<?php echo get_the_post_thumbnail_url( $post ); ?>" alt="featured article title image">
<?php endif; ?>
</article>
<?php endif; ?>
</section>
<h2 class="text-center"><?php _e( 'Latest Posts', 'thunderblog' ); ?></h2>
<section class="articles">
<?php get_template_part( 'parts/post-list' ); ?>
</section>
<?php get_template_part( 'parts/post-pagination' ); ?>
</main>
<?php get_footer(); ?>