WordPress single.phpの雛形

Bootstrap用Wordpress single.phpのコピペ用メモ。

WordPress single.phpの雛形

<?php get_header(); ?>

<section class="container">
  <div class="row">
    <?php if(have_posts()): 
    while(have_posts()): the_post(); ?>
    <div class="col-xs-12 col-md-9">
      <article <?php post_class(); ?>>
        <h1><?php the_title(); ?></h1>
            <?php the_content(); ?>
        <div class="navlink">
          <span class="navlink-prev">
            <?php previous_post_link('%link', '<i class="fa fa-angle-double-left"></i> %title'); ?>
          </span>
          <span class="navlink-next">
            <?php next_post_link('%link', '%title <i class="fa fa-angle-double-right"></i>'); ?>
          </span>
        </div>
        <?php comments_template(); ?>
        <div class="postinfo">
          <a href="<?php echo get_month_link( get_the_date('Y'), get_the_date('m') ); ?>">
           <time datetime="<?php echo get_the_date( 'c' ); ?>">
             <?php echo get_the_date(); ?> </time>
          </a> <?php if( has_category() ): ?> <span> <i class="fa fa-folder-open"></i> <?php the_category( ', ' ); ?> </span>
          <?php endif; ?>
          <?php the_tags( '<span><i class="fa fa-tag"></i> ', ', ', '</span>' ); ?>
          <?php the_terms( $post->ID, 'area', '<span><i class="fa fa-map-marker"></i> ', ', ', '</span>' ); ?>
        </div>
      </article>
    <?php endwhile; endif; ?>
    </div>
    <div id="sidemenu" class="col-xs-12 col-md-3">
    <?php dynamic_sidebar( 'single-rightside' ) ?>
    </div>
  </div><!-- /row -->
</section><!-- /container -->

<?php get_footer(); ?>

※h,pなどのタグは構成に応じて変更。

コメントを残す