XPressME Integration Kit

Trac


Ignore:
Timestamp:
Dec 29, 2008, 2:17:00 AM (15 years ago)
Author:
toemon
Message:

コンテンツの概要表示用カスタム関数実装 #12
xpress_the_content($more_link_text = ,$excerpt_size = 0,$show = true)
パラメータ

$more_link_text 「続きを読む」などのテキスト
$excerpt_size 概要表示の文字数(0のときは全文表示)
$show アウトプットをechoするかしないか。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/include/custom_functions.php

    r56 r57  
    297297} 
    298298 
     299function xpress_the_content($more_link_text = '',$excerpt_size = 0,$show = true) 
     300{ 
     301        $content = get_the_content();    
     302        if($excerpt_size > 0) { 
     303 
     304                $content = apply_filters('the_excerpt_rss', $content); 
     305                $content = strip_tags($content); 
     306 
     307                if (mb_strlen($content) > $excerpt_size){  
     308                        $content = mb_substr($content, 0, $excerpt_size);  
     309                        $content .= '... '; 
     310                        if (!empty($more_link_text)) $content .= '<p align="center"><a href="'. get_permalink() . "\">".$more_link_text .'</a></p>'; 
     311                } 
     312        } 
     313        if(empty($show)) return $content; 
     314        echo $content; 
     315} 
    299316 
    300317?> 
Note: See TracChangeset for help on using the changeset viewer.