-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-project.php
84 lines (79 loc) · 3.04 KB
/
single-project.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
<?php get_header(); ?>
<?php wp_link_pages(); ?>
<div class="main__content">
<div class="align-left"><a href="<?php echo get_post_type_archive_link(get_post_type()); ?>">« プロジェクト一覧に戻る</a>
</div>
<!-- Report -->
<div id="post-<?php the_ID(); ?>" <?php post_class("report"); ?>>
<?php
if (have_posts()) : // WordPress ループ
while (have_posts()) :
the_post(); // 繰り返し処理開始 ?>
<div class="report__meta">
<div class="post_title">
<h3 class="report__title"><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></h3>
</div>
<?php if (comments_open()) : ?>
<p><?php comments_popup_link('Comment : 0', 'Comment : 1', 'Comments : %'); ?></p>
<?php endif; // comments_open() ?>
<p class="report__info">Last Updated:<?php echo get_lastupdated_time("Y年n月j日"); ?></p>
</div>
<div class="entry_body">
<?php the_content(); ?>
</div>
</div>
<?php
$args = array(
'before' => '<div class="page-link">',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
);
wp_link_pages($args); ?>
<!-- post navigation -->
<div class="navigation">
<?php
if (get_previous_post()): ?>
<div class="align-left"><?php previous_post_link('%link', '« %title'); ?></div>
<?php
endif;
if (get_next_post()): ?>
<div class="align-right"><?php next_post_link('%link', '%title »'); ?></div>
<?php
endif;
?>
</div>
<!-- /post navigation -->
<?php comments_template(); // コメント欄の表示 ?>
<?php
endwhile; // 繰り返し処理終了
else : // ここから記事が見つからなかった場合の処理
include('no-article.php');
endif;
?>
</div>
<!-- /Main Content -->
<div class="main__sidebar">
<div class="project__list">
<!-- <h3>プロジェクト</h3> -->
<div class="project__listbody">
<ul>
<?php $args = array(
'numberposts' => 15, //表示する記事の数
'post_type' => 'project' //投稿タイプ名
// 条件を追加する場合はここに追記
);
$customPosts = get_posts($args);
if ($customPosts) : foreach ($customPosts as $post) : setup_postdata($post);
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php else : //記事が無い場合 ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif;
wp_reset_postdata(); //クエリのリセット ?>
</ul>
</div>
</div>
</div>
<?php get_footer(); ?>