「Wordpress/抜粋の文字数とmore文字の変更(マルチバイト)」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
1. [[WP Multibyte Patch>>http://eastcoder.com/code/wp-multibyte-patch/]] をインストールする
2. wpmp-config-sample-ja.php を wpmp-config.php に変名して以下配置。(WP_CONTENT_DIR を変更している場合はその中に)
>/wp-content/wpmp-config.php
3. function.phpに以下のコード
#highlight(php){{
// 抜粋の文字数
function my_excerpt_length($length) {
return 50;
}
add_filter('excerpt_mblength', 'my_excerpt_length');
// more の変更
function my_excerpt_more($more) {
return '.....';
}
add_filter('excerpt_more', 'my_excerpt_more');
// more をリンクにする場合はこっち
function my_excerpt_more($post) {
return '<a href="'. get_permalink($post->ID) . '">' . '...続きを読む' . '</a>';
}
add_filter('excerpt_more', 'my_excerpt_more');
}}
1. [[WP Multibyte Patch>>http://eastcoder.com/code/wp-multibyte-patch/]] をインストールする
2. wpmp-config-sample-ja.php を wpmp-config.php に変名して以下配置。(WP_CONTENT_DIR を変更している場合はその中に)
>/wp-content/wpmp-config.php
3. function.phpに以下のコード
#highlight(php){{
// 抜粋の文字数
function my_excerpt_length($length) {
return 50;
}
add_filter('excerpt_mblength', 'my_excerpt_length');
// more の変更
function my_excerpt_more($more) {
return '.....';
}
add_filter('excerpt_more', 'my_excerpt_more');
// more をリンクにする場合はこっち
function my_excerpt_more($post) {
return '<a href="'. get_permalink($post->ID) . '">' . '...続きを読む' . '</a>';
}
add_filter('excerpt_more', 'my_excerpt_more');
}}