-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-with-post.php
51 lines (51 loc) · 1.26 KB
/
page-with-post.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
<?php
/*
Template Name: page-with-posts
*/
get_header();
?>
<main>
<section class="article-page">
<?php
$category = 'not-exists-category'; // default
if(have_posts()):
while(have_posts()):
the_post();
the_title('<h1>', '</h1>');
the_content();
$category = get_post_meta(get_the_ID(), 'show_post_category', true);
endwhile;
endif;
$category = !$category ? 'not-exists-category' : $category;
query_posts(array('category_name' => $category));
?>
<div class="article-list">
<?php
if(have_posts()):
while(have_posts()):
the_post();?>
<article id="<?php the_ID();?>" class="list-post standard-post sticky">
<?php
get_template_part( 'template/page/common_cover', get_post_format());
get_template_part( 'template/page/common_card', get_post_format());
?>
</article>
<?php
endwhile;
else:
?>
<section class="error">
<img src="<?php echo img_base_url() . '404-anim.gif'; ?>" alt="404">
<h2>Oops!</h2>
<h3>指定的文章类别不存在</h3>
<h6>Error Code: 404</h6>
</section>
<?php endif; ?>
</div>
</section>
<?php
get_template_part( 'template/auth/sign-up', get_post_format());
?>
</main>
<?php
get_footer();