今の自分にできることを、集中し全力を尽くせ

info@example.com 000-000-0000

Do your best !

今の自分にできることを、集中し全力を尽くせ

WordPress開発講座04

記事の詳細ページを作成します。

テンプレート階層では個別ページの中の個別投稿ページ、個別投稿ページの中のブログ投稿を使用します。

個別投稿ページは「single.php」で作成します。

WordPress側にsingle.phpを作り、Bootstrapで作成した記事ページのコードをコピーして貼り付けます。

index.phpと同じようにコードを書き換えます。

hedaer
nav
hero
footerなど…

コンテンツの中身を書きます。

実例

<div class="container single-content">
<div class="row">
<?php if(have_posts()): while (have_posts()):the_post(); ?>
<section class="content-area col-sm-12 col-lg-8">
<header class="entry-header">
<h1 class="entry-title"><?php the_title( ); ?></h1>		
<div class="entry-meta">
<span class="posted-on">投稿日 <?php the_time('Y.m.d'); ?></span> | <span class="byline">投稿者 <span class="author"><?php the_author(); ?></span></span>
</div>
</header>
<div class="entry-content">
<p><?php the_content(); ?></p>
</div>
</section>
<?php endwhile; endif; ?>

<?php get_sidebar('right'); ?>
</div>
</div><!-- container END -->

全文を表示したいので、記事の部分を下記のコードにするのを忘れずに

<div class="entry-content">
<p><?php the_content(); ?></p>
</div>

記事がすべて表示されます。

参考サイト

https://www.youtube.com/watch?v=vc91Z4q97C0

Side Contents

Category List

Archive List

タグ