예제 #1
0
            <a href="<?php 
        the_permalink();
        ?>
" class="related-entry-title-link" title="<?php 
        the_title();
        ?>
">
            <?php 
        the_title();
        //記事のタイトル
        ?>
            </a></h3>
        </header>
        <p class="related-entry-snippet">
       <?php 
        echo get_the_custom_excerpt($post->post_content, get_excerpt_length()) . '';
        //カスタマイズで指定した文字の長さだけ本文抜粋
        ?>
</p>

        <?php 
        if (get_theme_text_read_entry()) {
            //「記事を読む」のようなテキストが設定されている時
            ?>
        <footer>
          <p class="related-entry-read"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            echo get_theme_text_read_entry();
            //デフォルト:記事を読む
예제 #2
0
function get_the_description()
{
    global $post;
    // if ( is_home() ) {
    //   $desc  = get_bloginfo('description');
    // } elseif ( is_category() ) {
    //   if ( category_description() ) {
    //     $desc  = mb_substr(strip_tags(category_description()), 0, 110);
    //   } else {
    //     $desc  = 'カテゴリページ';
    //   }
    // } elseif ( is_page() || is_single() ) {
    //   $desc = trim(strip_tags( $post->post_excerpt ));
    //   if ( !$desc ) {//投稿で抜粋が設定されていない場合は、110文字の冒頭の抽出分
    //     $desc = strip_shortcodes(get_the_custom_excerpt( $post->post_content, 150 ));
    //   }
    //   $desc = mb_substr(str_replace(array("\r\n", "\r", "\n"), '', strip_tags($desc)), 0, 110);
    //   $desc = htmlspecialchars($desc);
    // } elseif(is_404()) {
    //   $desc  = '404ページ';
    // }
    $desc = trim(strip_tags($post->post_excerpt));
    if (!$desc) {
        //投稿で抜粋が設定されていない場合は、110文字の冒頭の抽出分
        $desc = strip_shortcodes(get_the_custom_excerpt($post->post_content, 150));
    }
    $desc = mb_substr(str_replace(array("\r\n", "\r", "\n"), '', strip_tags($desc)), 0, 110);
    $desc = htmlspecialchars($desc);
    return $desc;
}
    echo get_the_permalink() . $comment_count_anchor;
    ?>
" class="comment-count-link"><?php 
    echo get_comments_number();
    ?>
</a>
          </span>
        </span>
      <?php 
}
?>

    </p><!-- /.post-meta -->
  </header>
  <p class="entry-snippet"><?php 
echo get_the_custom_excerpt(get_the_content(''), get_excerpt_length());
//カスタマイズで指定した文字の長さだけ本文抜粋
?>
</p>

  <?php 
if (get_theme_text_read_entry()) {
    //「記事を読む」のようなテキストが設定されている時
    ?>
  <footer>
    <p class="entry-read"><a href="<?php 
    the_permalink();
    ?>
" class="entry-read-link"><?php 
    echo get_theme_text_read_entry();
    //記事を読む
예제 #4
0
 function get_the_description()
 {
     global $post;
     $desc = trim(strip_tags($post->post_excerpt));
     if (!$desc) {
         //投稿で抜粋が設定されていない場合は、110文字の冒頭の抽出分
         $desc = strip_shortcodes(get_the_custom_excerpt($post->post_content, 150));
         $desc = mb_substr(str_replace(array("\r\n", "\r", "\n"), '', strip_tags($desc)), 0, 120);
     }
     $desc = htmlspecialchars($desc);
     return $desc;
 }