-
Notifications
You must be signed in to change notification settings - Fork 12
/
front-page.php
59 lines (47 loc) · 1.33 KB
/
front-page.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
<?php get_header();
$aArgs = array( 'post_per_page' => 8, );
$aPosts = get_posts( $aArgs );
?>
<main>
<div class="container">
<div class="row">
<section class="items col-md-8 col-md-push-4">
<header>
<h1><?php the_title(); ?></h1>
</header>
<?php
foreach( $aPosts as $oPost ) :
setup_postdata( $oPost );
?>
<article id="post-<?php echo $oPost->ID; ?>">
<h2><?php echo get_the_title( $oPost->ID ); ?></h2>
<?php
if ( has_post_thumbnail($oPost->ID) ) {
echo get_the_post_thumbnail($oPost->ID, 'square');
}
?>
<div class="entry">
<?php the_excerpt(); ?>
<a href="<?php echo get_permalink( $oPost->ID ); ?>"><?php _e('Read more', 'od'); ?></a>
</div>
</article>
<?php endforeach; ?>
<?php
$postId = wp_get_post_categories($aPosts[0]->ID);
$postCategory = get_category($postId[0])->slug;
?>
<div class="see-all">
<a class="btn btn-primary btn-lg" href="<?php echo '/' . $postCategory ?>"><?php _e('More news', 'od') ?></a>
</div>
</section>
<?php if( is_active_sidebar('sidebar_home') ) : ?>
<aside role="complementary" class="col-md-4 col-md-pull-8">
<ul class="widgets">
<?php dynamic_sidebar( 'sidebar_home' ); ?>
</ul>
</aside>
<?php endif; ?>
</div>
</div>
</main>
<?php get_footer(); ?>