下記、
カテゴリーページ(category.php)のコードになります。
<?php get_header(); ?> <!--CONTENTS--> <div id="contents"> <!--MAIN--> <div class="main" id="archive"> <h2><?php the_category(' // ') ?>の記事一覧</h2> <?php foreach((get_the_category()) as $cat) { $catid = $cat->cat_ID ; break ; } $get_posts_parm = "'numberposts=&category=" . $catid . "'"; ?> <div class="cont"> <?php $posts = get_posts($get_posts_parm); ?> <?php foreach($posts as $post): ?> <ul class="content2"> <a href="<?php the_permalink() ?>"> <li class="img"><?php the_post_thumbnail('thumbnail'); ?></li> <li class="title"><?php if(mb_strlen($post->post_title)>25) { $title= mb_substr($post->post_title,0,25) ; echo $title. ・・・ ;} else {echo $post->post_title;}?></li> <li class="cat"><?php the_category(', ') ?></li> <li class="date"><?php the_time('Y年m月j日') ?></li> <li class="text"><?php $text= mb_substr(strip_tags($post-> post_content), 0, 80); echo $text. '...'; ?></li></a> <a href="<?php the_permalink() ?>"><li class="read">続きを読む▶</li></a> </ul> <?php endforeach; ?> </div> <?php wp_pagenavi(); ?> <div class="readall"> <a href="<?php echo home_url(); ?>"><p>すべての記事を見る</p></a> </div> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>