-
Notifications
You must be signed in to change notification settings - Fork 521
/
template-posts.php
68 lines (60 loc) · 2.41 KB
/
template-posts.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
<?php
/*
Template Name: 文章列表
*/
get_header();
include( 'templates/header-nav.php' );
// 获取文章列表
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$args = array(
'ignore_sticky_posts' => 1,
'paged' => $paged,
);
if(isset($_GET['cat']))
$args['cat'] = $_GET['cat'];
$args = apply_filters('io_blog_post_query_var_filters', $args);
query_posts( $args );
?>
<div class="main-content page">
<?php include( 'templates/header-banner.php' ); ?>
<div class="container">
<div class="row mt-5 mt-sm-0">
<div class="col-12 mx-auto">
<div class="panel panel-default">
<div class="cat_list">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post();?>
<div class="list-content my-3 pb-4">
<h2 class="post-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="list-title text-lg overflowClip_2"><?php the_title(); ?></a>
</h2>
<div class="post-meta d-flex align-items-center text-muted text-xs">
<?php
$category = get_the_category();
if($category[0]){ ?>
<span><i class="fa fa-folder mr-1"></i>
<a href="<?php echo get_category_link($category[0]->term_id ) ?>"><?php echo $category[0]->cat_name ?></a>
</span>
<?php } ?>
<span class="ml-auto"><i class="fa fa-calendar mr-1"></i>
<time class="mx-1"><?php echo get_the_time('Y-m-d G:i') ?></time>
</span>
</div>
<div class="list-desc text-sm text-secondary my-4">
<div class="overflowClip_2 "><?php echo io_get_excerpt(150) ?></div>
</div>
</div>
<?php endwhile; endif;?>
</div>
<div class="posts-nav">
<?php echo paginate_links(array(
'prev_next' => 0,
'before_page_number' => '',
'mid_size' => 2,
));?>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>