/
home.php
72 lines (57 loc) · 1.9 KB
/
home.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
61
62
63
64
65
66
67
68
69
70
71
72
<?php get_header(); ?>
<main id="main" role="main">
<?php
$page_title = 'News';
$page_subtitle = '';
?>
<header>
<p class="breadcrumb"><?php get_breadcrumb(); ?> / News</p>
<?php if ( $page_title ) { ?>
<h1><?php echo wp_kses_post( $page_title ); ?></h1>
<?php } ?>
</header>
<div class="c-blog-posts h-feed">
<?php
// Pagination
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// Example argument that defines three posts per page.
$args = array(
'posts_per_page' => 12,
'post_status' => 'publish',
'paged' => $paged,
'orderby' => 'date',
'order' => 'DESC'
);
// Variable to call WP_Query.
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
?>
<?php
// Start the Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
// Loop Content
include 'template-parts/cards/ucla-story-card.php';
// End the Loop
endwhile;
?>
<?php
else:
// If no posts match this query, output this text.
_e( 'Sorry, no results match your criteria.', 'textdomain' );
endif;
wp_reset_postdata();
?>
</div>
<nav class="nav-links pagination u-max-width">
<?php echo paginate_links([
'format' => 'page/%#%',
'current' => $paged,
'total' => $the_query->max_num_pages,
'mid_size' => 10,
'prev_text' => __('«'),
'next_text' => __('»')
]); ?>
</nav>
<?php get_template_part('nav', 'below'); ?>
</main>
<?php get_footer(); ?>