forked from wpcampus/wpcampus-wp-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfront-page.php
60 lines (44 loc) · 1.39 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
60
<?php
get_header();
wpcampus_print_main_callout();
if ( ! have_posts() ) :
wpcampus_print_404();
else :
while ( have_posts() ) :
the_post();
wpcampus_print_article();
endwhile;
endif;
// Display blog posts.
$query_posts = new WP_Query( array(
'post_type' => array( 'post', 'podcast', 'video' ),
'posts_per_page' => 5, // @TODO add pagination
));
if ( $query_posts->have_posts() ) :
// Add article meta after header.
add_action( 'wpcampus_after_article_header', 'wpcampus_print_article_meta', 5 );
// Setup article arguments.
$args = array(
'header' => 'h3',
'print_content' => false,
);
add_filter( 'the_title', 'wpcampus_prepend_post_title', 100, 2 );
?>
<div class="wpcampus-front-page-articles">
<h2><?php printf( __( 'From The %s Community', 'wpcampus' ), 'WPCampus' ); ?></h2>
<?php
// Print the articles.
wpcampus_print_articles( $args, $query_posts );
?>
<ul class="button-group">
<li><a href="/blog/" class="button"><?php _e( 'Read more on our blog', 'wpcampus' ); ?></a></li>
<li><a href="/videos/" class="button"><?php _e( 'Watch our videos', 'wpcampus' ); ?></a></li>
<li><a href="/podcast/" class="button"><?php _e( 'Listen to the podcast', 'wpcampus' ); ?></a></li>
</ul>
</div>
<?php
remove_filter( 'the_title', 'wpcampus_prepend_post_title', 100, 2 );
// Reset the main query post data.
wp_reset_postdata();
endif;
get_footer();