forked from librewiki/liberty-skin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
138 lines (132 loc) · 3.89 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/**
* Liberty theme main page.
*
* @package Liberty
* @since 1.0.0
*/
get_header(); ?>
<body <?php body_class(); ?>>
<div class="Liberty">
<?php get_template_part( 'template/navbar' ); ?>
<section>
<div class="content-wrapper">
<?php get_template_part( 'template/sidebar' ); ?>
<div class="container-fluid liberty-content">
<div class="liberty-content-header">
<div class="alert alert-dismissible fade in alert-info liberty-notice liberty-notice-loop" role="alert">
<?php
if ( is_category() ) {
echo ( category_description() );
} else {
bloginfo( 'description' );
}
?>
</div>
<!--
<div class="content-tools">
<div class="btn-group" role="group" aria-label="content-tools">
<button type="button" class="btn btn-secondary tools-btn tools-share">
<i class="far fa-share-square"></i>
공유
</button>
</div>
</div>-->
</div>
<div class="liberty-content-main liberty-content-loop">
<?php
$query_paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$query_cat = ( get_query_var( 'cat' ) ) ? get_query_var( 'cat' ) : -1;
$args = array(
'post_type' => 'post',
'paged' => $query_paged,
'posts_per_page' => 5,
'post_status' => 'publish',
'cat' => $query_cat,
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
$post_count = 0;
while ( $the_query->have_posts() ) {
$the_query->the_post();
?>
<article class="content-loop">
<div class="main_posttitle">
<a href=<?php the_permalink(); ?>>
<h2><?php the_title(); ?></h2>
</a>
<i class="far fa-comments"></i>
<?php comments_number(); ?>
<div class="written_time">
<i class="far fa-clock"></i> <?php the_date( 'Y년 F j', '', '일', true ); ?> <?php the_time( 'a g:i에 작성됨.' ); ?>
</div>
</div>
<hr>
<div style="clear:both"></div>
<?php
if ( 0 === $post_count && is_sticky() ) :
the_content();
else :
the_excerpt();
?>
<!--
<div class="liberty-article-more">
<hr>
<a href="<?php the_permalink(); ?>" class="liberty-article-morelink">더 보기</a>
</div> -->
<?php endif; ?>
</article>
<?php
$post_count++;
if ( 10 === $post_count ) :
break;
endif;
};
?>
<div class="content-loop-page">
<?php
if ( 1 !== $query_paged ) {
?>
<div class="previous-page page-button">
<?php previous_posts_link( __( '이전 페이지', 'textdomain' ) ); ?>
</div>
<?php
};
if ( $query_paged !== $the_query->max_num_pages ) :
?>
<div class="next-page page-button">
<?php next_posts_link( __( '다음 페이지', 'textdomain' ), $the_query->max_num_pages ); ?>
</div>
<?php
endif;
wp_reset_postdata();
?>
</div>
<?php else : ?>
<article class="content-loop">
<div class="main_posttitle">
<h2 style="color:#3399FF">아직 여기에는 글이 없는 것 같습니다....</h2>
</div>
<div style="clear:both"></div>
</article>
<?php
if ( 1 !== $query_paged ) {
?>
<div class="previous-page page-button">
<?php previous_posts_link( __( '이전 페이지', 'textdomain' ) ); ?>
</div>
<?php
wp_reset_postdata();
};
endif;
?>
</div>
<?php get_footer(); ?>
<?php get_template_part( 'template/nav-button' ); ?>
</div>
</div>
</section>
</div>
<?php wp_footer(); ?>
</body>
</html>