1.通常のタイトル表示・リンク付き
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"> <?php the_title(); ?> </a>
2.文字数制限する場合
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"> <?php if (strlen($post->post_title) > 50) { echo mb_substr(the_title($before = '', $after = '', FALSE), 0, 50) . '...'; } else { the_title(); }; ?> </a>
50文字以上のときに50文字目以降を省略して「…」をつける。
1.通常の本文表示
<?php the_content(); ?>
2.文字数を制限する場合
<?php function my_excerpt( $length ) { global $post; $content = mb_substr( strip_tags( $post -> post_content ), 0, $length ); $content = $content . ' ... <a class="more" href="'. get_permalink() . '">続きを読む</a>'; return $content; } ?>
テンプレートに記述
<?php echo my_excerpt(200); ?>
200文字以上は省略し「…」の後にリンク付きの「続きを読む」。