<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>delab &#187; excerpt</title>
	<atom:link href="http://de-lab.com/tag/excerpt/feed/" rel="self" type="application/rss+xml" />
	<link>http://de-lab.com</link>
	<description>xhtml CSS SEO CMS PHP など Webデザイン WEBサイト構築の話題</description>
	<lastBuildDate>Wed, 05 Oct 2011 23:41:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>WordPressとNucleusの記事本文から文字数で概要を抜粋する方法</title>
		<link>http://de-lab.com/article/wordpress_excerpt/</link>
		<comments>http://de-lab.com/article/wordpress_excerpt/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 08:17:35 +0000</pubDate>
		<dc:creator>sato</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://de-lab.com/web/wordpress_excerpt/</guid>
		<description><![CDATA[NucleusやMovableTypeでは簡単にできる概要表示が、Wordpressで手こずったので、メモしておきます。 プラグインを入れて、RSSとコメントと記事の概要を一定の文字数で抜き出せるようにしました。 Wor [...]]]></description>
			<content:encoded><![CDATA[<div class="disc">
<p>NucleusやMovableTypeでは簡単にできる概要表示が、Wordpressで手こずったので、メモしておきます。</p>
<p>プラグインを入れて、RSSとコメントと記事の概要を一定の文字数で抜き出せるようにしました。</p>
</div>
<p><span id="more-17"></span></p>
<h2 id="toc-worpdress">Worpdressの概要の文字数を日本語でカウントする方法</h2>
<p>記事に概要をその都度記述しているなら必要ないのですが、記述していない場合、本文から一定の文字数で概要を抜き出してくれる機能を使っていると思います。</p>
<p>Nucleusだと<code><%syndicate_description(文字数)%></code>で抜粋を表示することができます。</p>
<p>WordPressも、<code>the_excerpt()</code>では、概要が空欄だった場合は、55ワードで省略されます。</p>
<p>ただ、Wordpressの場合、ノーマルの状態で、うまく概要が表示されない不具合があります。</p>
<p>WordPressはもともと英語圏で作られたツールなので、日本語では利用できない処理方法を用いているためなのですが、抜粋処理の方法が、単語間のスペースを利用するワードカウントで処理されており、単語間の区切りがない日本語(マルチバイト文字)ではうまく抜粋できないということです。</p>
<p>調べたら、マルチバイトの問題を解消するためのパッチやプラグインがいろいろと出ていました。</p>
<p>コアファイルに手を加えると、バージョンアップの時に面倒なので、一番手軽そうなプラグインを入れてみました。</p>
<blockquote cite='http://www.techdego.com/2007/02/mb_excerpt_plugin.php?griffin_skin=2b-2r-l' title='the_excerpt()で漢字も対応させるplugin | Tech de Go'><p><cite><a href="http://www.techdego.com/2007/02/mb_excerpt_plugin.php?griffin_skin=2b-2r-l" target="_blank" class="liexternal">the_excerpt()で漢字も対応させるplugin | Tech de Go</a></cite></p>
<p>このプラグインは、wordpressのthe_excerpt(), the_excerpt_rss(), comment_excerpt()の３つの関数をフィルターして、マルチバイト文字100文字（デフォルト）で省略の「．．．」を表示する。</p>
</blockquote>
<h3 id="toc-mb_excerpt_plugin">mb_excerpt_pluginのインストール</h3>
<p>ダウンロードしたら、拡張子を.txtから.phpに変更して、プラグインフォルダに入れて有効化するだけです。</p>
<p>抜粋文字数は、12行目位から設定します。</p>
<p class="code">mb_excerpt.php</p>
<pre name="code" class="c">$mb_excerpt_word = 100; // 抜粋文字数
$mb_rss_word = 100;// RSS抜粋文字数
$mb_comment_word = 80;// コメント抜粋文字数</pre>
<p>こちらで変更できます。</p>
<img src="http://de-lab.com/?ak_action=api_record_view&id=17&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://de-lab.com/article/wordpress_excerpt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

