うさぎのイラスト

ネットアンサー55備忘録

web技術を書いていきます

アーカイブページの作成

-2015年03月18日-
1<?php
2if(have_posts()): while(have_posts()): the_post();?>
3    <div class="blogloop">
4        <div class="post-thumb img-block"><a href="<?php the_permalink(); ?>"><?php the_category_image();?> <!--設定はfunctions.phpに--></a></div>
5        <div class="post-right">
6            <h1 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
7            <?php $terms01 = get_the_term_list( get_the_ID(), 'blog_cat' );  ?>
8            <div class="post-date"><?php the_date(); ?> <br />
9            <span><?php echo $terms01; ?></span></div>
10            <?php echo mb_substr(get_the_excerpt(), 0, 38),"..."; ?>
11        </div><!-- / .post-right -->
12    </div><!-- / .blogloop -->
13    <?php endwhile; ?>               
14    <div id="paging" >
15    <?php
16    // ページングを表示
17if (function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
18<?php endif;    
19wp_reset_query();
20?>
21    </div><!-- / #paging -->
●loop-blog.phpとしてまとめておくと便利です。 ループさせたい箇所に下記のように設置します。
1<?php get_template_part('loop','blog'); ?>