<?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>Webnist Code</title>
	<atom:link href="http://sauce.webnist.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://sauce.webnist.net</link>
	<description>Just another Webnist（うぇぶにすと) Blog Sites site</description>
	<lastBuildDate>Mon, 20 Jun 2011 10:05:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>スライド表示用投稿を作ってみる</title>
		<link>http://sauce.webnist.net/2011/06/05/%e3%82%b9%e3%83%a9%e3%82%a4%e3%83%89%e8%a1%a8%e7%a4%ba%e7%94%a8%e6%8a%95%e7%a8%bf%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e3%2582%25b9%25e3%2583%25a9%25e3%2582%25a4%25e3%2583%2589%25e8%25a1%25a8%25e7%25a4%25ba%25e7%2594%25a8%25e6%258a%2595%25e7%25a8%25bf%25e3%2582%2592%25e4%25bd%259c%25e3%2581%25a3%25e3%2581%25a6%25e3%2581%25bf%25e3%2582%258b</link>
		<comments>http://sauce.webnist.net/2011/06/05/%e3%82%b9%e3%83%a9%e3%82%a4%e3%83%89%e8%a1%a8%e7%a4%ba%e7%94%a8%e6%8a%95%e7%a8%bf%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 08:49:23 +0000</pubDate>
		<dc:creator>Webnist</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://sauce.webnist.net/?p=69</guid>
		<description><![CDATA[ども、WPer 界で上位に食い込む位いい声の Webnist です。 ネタが尽きてきた中で頭を絞って出てきた、一滴を今回書いていこうかと思います。 その内容は、最近？流行りのスライドで写真等を表示する事をWordPressで簡単にやってしまおうということです。 今回、準備頂く物は以下になります。 WordPress (動くまでが WordPress です) くじけぬ心 向上心 スライド表示用のカスタム投稿タイプ(Custom Post Type) jQuery の Orbit ライブラリー (http://www.zurb.com/playground/orbit-jquery-image-slider) 今回使用するテーマはめ組さんの膳テーマを使用しています。 に掲げた5項目です。 1〜3については、飛ばしまーす。 スライド表示用カスタム投稿タイプについて これについては、検索すると色々なところで解説されているので詳しく書かないですが、 おでさんの『カスタム投稿タイプ(Custom Post Type)の導入と使い方 [WordPress 3.0]』を読めば理解できると思いますよ。 ソースコードで追加していくのは、ちょっと面倒なので僕は楽をして、プラグインを使います。 僕が使っているプラグインは 『GD Custom Posts And Taxonomies Tools』 というですね、理由は特にありませんが&#8230; &#8230; <a href="http://sauce.webnist.net/2011/06/05/%e3%82%b9%e3%83%a9%e3%82%a4%e3%83%89%e8%a1%a8%e7%a4%ba%e7%94%a8%e6%8a%95%e7%a8%bf%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b/">続きを読む<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ども、WPer 界で上位に食い込む位いい声の Webnist です。</p>
<p>ネタが尽きてきた中で頭を絞って出てきた、一滴を今回書いていこうかと思います。<br />
その内容は、最近？流行りのスライドで写真等を表示する事をWordPressで簡単にやってしまおうということです。</p>
<p>今回、準備頂く物は以下になります。</p>
<ol>
<li>WordPress (動くまでが WordPress です)</li>
<li>くじけぬ心</li>
<li>向上心</li>
<li>スライド表示用のカスタム投稿タイプ(Custom Post Type)</li>
<li>jQuery の Orbit ライブラリー (<a title="Orbit ライブラリー" href="http://www.zurb.com/playground/orbit-jquery-image-slider" target="_blank">http://www.zurb.com/playground/orbit-jquery-image-slider</a>)</li>
<li>今回使用するテーマは<a title="め組テーマ" href="http://www.10press.net" target="_blank">め組</a>さんの<a title="め組：膳テーマ" href="http://www.10press.net/theme/3284" target="_blank">膳テーマ</a>を使用しています。</li>
</ol>
<p>に掲げた5項目です。</p>
<p>1〜3については、飛ばしまーす。</p>
<h2>スライド表示用カスタム投稿タイプについて</h2>
<p>これについては、検索すると色々なところで解説されているので詳しく書かないですが、<br />
おでさんの『<a title="カスタム投稿タイプ(Custom Post Type)の導入と使い方 [WordPress 3.0]" href="http://www.odysseygate.com/archives/1624" target="_blank">カスタム投稿タイプ(Custom Post Type)の導入と使い方 [WordPress 3.0]</a>』を読めば理解できると思いますよ。</p>
<p>ソースコードで追加していくのは、ちょっと面倒なので僕は楽をして、プラグインを使います。<br />
僕が使っているプラグインは 『<a title="GD Custom Posts And Taxonomies Tools" href="http://wordpress.org/extend/plugins/gd-taxonomies-tools/" target="_blank">GD Custom Posts And Taxonomies Tools</a>』 というですね、理由は特にありませんが&#8230; ただ、このプラグイン日本語化されていないのです。。。<br />
僕は英語がわからないので、誰か日本語化してくれないかなっと期待しています。</p>
<p>今回はスライド用なので分かりやすく 『slide』というカスタム投稿タイプを作成します。</p>
<div id="attachment_74" class="wp-caption alignleft" style="width: 211px"><a href="http://sauce.webnist.net/files/GD_CPT_Tools.png"><img class="size-medium wp-image-74 " title="GD_CPT_Tools" src="http://sauce.webnist.net/files/GD_CPT_Tools-201x300.png" alt="" width="201" height="300" /></a><p class="wp-caption-text">GD CPT Tools の設定画面</p></div>
<p>Name のところでカスタム投稿タイプの名前を入力します。（日本語は避けといたほうが安全です。）</p>
<p>Labels のところでカスタム投稿タイプのラベルを入力します。(日本語でも大丈夫です。)<br />
Auto fill rest をクリックすると他の部分は勝手に記入してくれます。が、日本語化されていないので英語で入ってきます。</p>
<p>Settings のところでカスタム投稿タイプの投稿画面に表示する項目を選択できます。<br />
今回は、スライド表示用なのでデフォルトに Excerpts と Post Thumbnails を追加しています。</p>
<p>とりあえず上記を設定して、Save Custom Post を押して保存します。</p>
<p>&nbsp;</p>
<div id="attachment_107" class="wp-caption alignleft" style="width: 159px"><a title="カスタム投稿メニュ" href="http://sauce.webnist.net/files/カスタム投稿メニュ.png"><img class="size-full wp-image-107" title="カスタム投稿メニュ" src="http://sauce.webnist.net/files/カスタム投稿メニュ.png" alt="カスタム投稿メニュ" width="149" height="120" /></a><p class="wp-caption-text">カスタム投稿メニュ</p></div>
<p>保存したら画像のようなメニューが追加されます。</p>
<h2>jQuery の Orbit ライブラリーの追加</h2>
<p><a title="Orbit ライブラリー" href="http://www.zurb.com/playground/orbit-jquery-image-slider" target="_blank">http://www.zurb.com/playground/orbit-jquery-image-slider</a> ここからファイルをダウンロードしてきます。</p>
<p>使用しているテーマに slide というフォルダを作ってその中に解凍してできた、orbit-1.2.3(記事を書いている時のバージョンは1.2.3です) 内の jquery.orbit-1.2.3.min.js, orbit-1.2.3.css, orbit をコピーします。</p>
<p>コピーしたら、テーマの functions.php を編集します。<br />
以下のソースで js を読み込みます。</p>
<pre>
add_action( 'wp_print_scripts', 'add_slide_js' );
function add_slide_js() {
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'orbit-script', get_stylesheet_directory_uri() . '/slide/jquery.orbit-1.2.3.min.js' );
}
</pre>
<p>以下のソースで CSS を読み込みます。</p>
<pre>
add_action( 'wp_print_styles', 'add_slide_style' ) ;
function add_slide_style() {
wp_enqueue_style( 'orbit-style', get_stylesheet_directory_uri() . '/slide/orbit-1.2.3.css' );
}
</pre>
<p>以下でスライド用のスクリプトを有効化します。</p>
<pre>
add_action( &#039;wp_head&#039;, &#039;add_slide_script&#039; );
function add_slide_script() { ?&amp;gt;
&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
 		jQuery(document).ready(function($){ 			$(&#039;#slide_box&#039;).orbit(); 		});
// ]]&gt;&lt;/script&gt;
&lt;?php } ?&gt;
</pre>
<pre>
$('#slide_box').orbit();
</pre>
<p>上記で、#slide_box と指定しましたので、orbit-1.2.3.css を編集します。</p>
<p>デフォルトでは、#featured となっている部分を、 #slide_box に変更しましょう。</p>
<p>これで、スライドの下準備は完了です。<br />
次に WordPress 側で、カスタム投稿タイプでスライド表示に進みます。</p>
<h2>カスタム投稿タイプでスライド表示</h2>
<p>さて、いよいよ大詰めにきました。<br />
ここで、一息入れてお菓子を食べるも、一気に進んでいくのもありです。</p>
<p>WordPress 側で、カスタム投稿タイプを表示する設定をしていきます。<br />
functions.php にまず以下を追加します。</p>
<pre>
add_image_size( 'slide-thumb', 970, 99999 );
</pre>
<p>これで、アイキャッチに追加したときの画像の大きさを追加します。<br />
大きさは、テーマによっては違うのでそれに合わせてください。</p>
<p>次に、カスタム投稿タイプを表示するために、以下を追加します。</p>
<pre>
function slide_post_list() {
global $post, $post_type;
$args = array(
&#039;numberposts&#039; =&amp;gt; 5,
&#039;post_type&#039; =&amp;gt; &#039;slide&#039;,
);
$get_posts = get_posts( $args );
if ( $get_posts ) {
$output = &#039;
&lt;div id=&quot;slide_area&quot;&gt;&#039; . &quot;\n&quot;;
$output .= &#039;
&lt;div id=&quot;slide_box&quot;&gt;&#039; . &quot;\n&quot;;
foreach( $get_posts as $post ) {
setup_postdata( $post );
$attachment_id = get_post_thumbnail_id();
$attachment_src = wp_get_attachment_image_src( $attachment_id, &#039;slide-thumb&#039; );
$output .= &#039;&lt;a title=&quot;&#039; . get_the_title() . &#039;&quot; href=&quot;&#039; . get_permalink() . &#039;&quot; data-caption=&quot;#slide_&#039; . $post-&gt;ID . &#039;&quot;&gt;&lt;img src=&quot;&#039; . $attachment_src[0] . &#039;&quot; alt=&quot;&#039; . get_the_title() . &#039;&quot; width=&quot;&#039; . $attachment_src[1] .&#039;&quot; height=&quot;&#039; . $attachment_src[2] .&#039;&quot; /&gt;&lt;/a&gt;&#039; . &quot;\n&quot;;
}
$output .= &#039;&lt;/div&gt;
&#039; . &quot;\n&quot;;
foreach( $get_posts as $post ) {
setup_postdata( $post );
$excerpt = $post-&amp;gt;post_excerpt;
$output .= &#039;&lt;span id=&quot;slide_&#039; . $post-&gt;ID . &#039;&quot; class=&quot;orbit-caption&quot;&gt;&#039; . $excerpt . &#039;&lt;/span&gt;&#039; . &quot;\n&quot;;
}
$output .= &#039;

&lt;/div&gt;
&#039; . &quot;\n&quot;;
echo $output;
}
}
</pre>
<p>上記を追加し保存したら、テーマの表示したい部分につかします。<br />
今回は、ヘッダーのメイン画像を置き換えて使用するために header.php に記述します。</p>
<pre>
&lt;?php slide_post_list(); ?&gt;
</pre>
<p>画像</p>
<p>以上で、スライド表示用投稿を作ってみるの紹介を終わりにします。<br />
あっそうそう、もちろん IE6 はサポート外ですよ。。。</p>
<p>外部サイトにリンクするという説明はまた別の話で。</p>
]]></content:encoded>
			<wfw:commentRss>http://sauce.webnist.net/2011/06/05/%e3%82%b9%e3%83%a9%e3%82%a4%e3%83%89%e8%a1%a8%e7%a4%ba%e7%94%a8%e6%8a%95%e7%a8%bf%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>コメントの項目足してみるパン</title>
		<link>http://sauce.webnist.net/2010/12/24/%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%81%ae%e9%a0%85%e7%9b%ae%e8%b6%b3%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b%e3%83%91%e3%83%b3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e3%2582%25b3%25e3%2583%25a1%25e3%2583%25b3%25e3%2583%2588%25e3%2581%25ae%25e9%25a0%2585%25e7%259b%25ae%25e8%25b6%25b3%25e3%2581%2597%25e3%2581%25a6%25e3%2581%25bf%25e3%2582%258b%25e3%2583%2591%25e3%2583%25b3</link>
		<comments>http://sauce.webnist.net/2010/12/24/%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%81%ae%e9%a0%85%e7%9b%ae%e8%b6%b3%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b%e3%83%91%e3%83%b3/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 00:00:58 +0000</pubDate>
		<dc:creator>Webnist</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://sauce.webnist.net/?p=51</guid>
		<description><![CDATA[WordPress のコメントの部分に項目を足すことは、サイトを検索すると引っかかりますが、 保存するところまでは説明されていませんでした。。。 そこで、データベースを見ていたら、commentmeta というテーブルがあるではないですか！ っということで、commentmetaを利用し、追加した項目を保存してみましょう。 とりあえず、テーマファイルの function.php に以下のソースを追加します。 // Comment Customize add_action( 'comment_form_field_comment', 'add_comment_field' ); function add_comment_field( $defaults ) { $defaults = '&#60;p class=&#34;comment-form-twitter&#34;&#62;&#60;label for=&#34;twitter&#34;&#62;twitter@&#60;/label&#62;&#60;input id=&#34;twitter&#34; name=&#34;twitter&#34; type=&#34;text&#34; value=&#34;&#34; size=&#34;15&#34; /&#62;&#60;/p&#62;'; $defaults .= '&#60;p class=&#34;comment-form-comment&#34;&#62;&#60;label for=&#34;comment&#34;&#62;' . _x( 'Comment', &#8230; <a href="http://sauce.webnist.net/2010/12/24/%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%81%ae%e9%a0%85%e7%9b%ae%e8%b6%b3%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b%e3%83%91%e3%83%b3/">続きを読む<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>WordPress のコメントの部分に項目を足すことは、サイトを検索すると引っかかりますが、<br />
保存するところまでは説明されていませんでした。。。</p>
<p>そこで、データベースを見ていたら、commentmeta というテーブルがあるではないですか！<br />
っということで、commentmetaを利用し、追加した項目を保存してみましょう。</p>
<p>とりあえず、テーマファイルの function.php に以下のソースを追加します。</p>
<pre>
// Comment Customize
add_action( 'comment_form_field_comment', 'add_comment_field' );
function add_comment_field( $defaults ) {
	$defaults = '&lt;p class=&quot;comment-form-twitter&quot;&gt;&lt;label for=&quot;twitter&quot;&gt;twitter@&lt;/label&gt;&lt;input id=&quot;twitter&quot; name=&quot;twitter&quot; type=&quot;text&quot; value=&quot;&quot; size=&quot;15&quot; /&gt;&lt;/p&gt;';
	$defaults .= '&lt;p class=&quot;comment-form-comment&quot;&gt;&lt;label for=&quot;comment&quot;&gt;' . _x( 'Comment', 'noun' ) . '&lt;/label&gt;&lt;textarea id=&quot;comment&quot; name=&quot;comment&quot; cols=&quot;45&quot; rows=&quot;8&quot; aria-required=&quot;true&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;';
	return $defaults;
}

add_action( 'comment_post', 'save_comment_field' );
add_action( 'edit_comment', 'save_comment_field' );
function save_comment_field( $comment_id ) {
	if ( !$comment = get_comment( $comment_id ) )
		return false;
	do_action('comment_form', $post-&gt;ID);
	$custom_key_twitter  = 'twitter';
    $get_comment_twitter = esc_attr( $_POST[$custom_key_twitter] );
    if ( &quot;&quot; == get_comment_meta( $comment_id, $custom_key_twitter )) {
        add_comment_meta( $comment_id, $custom_key_twitter, $get_comment_twitter, true ) ;
    } else if ( $get_comment_twitter != get_comment_meta( $comment_id, $custom_key_twitter )) {
        update_comment_meta( $comment_id, $custom_key_twitter, $get_comment_twitter ) ;
    } else if ( &quot;&quot; == $get_comment_twitter ) {
        delete_comment_meta( $comment_id, $custom_key_twitter ) ;
    }
	return false;
}

add_action( 'add_meta_boxes_comment', 'add_comment_field_box' );
function add_comment_field_box() {
    global $comment;
	$comment_ID = $comment-&gt;comment_ID;
    $custom_key         = 'post_reviews_date' ;
    $custom_key_twitter = 'twitter' ;
    $noncename          = $custom_key . '_noncename' ;
    $get_twitter        = esc_attr( get_comment_meta( $comment_ID, $custom_key_twitter, true ) );
    echo '&lt;input type=&quot;hidden&quot; name=&quot;' . $noncename . '&quot; id=&quot;' . $noncename . '&quot; value=&quot;' . wp_create_nonce( plugin_basename(__FILE__) ) . '&quot; /&gt;' . &quot;\n&quot;;
	echo '&lt;p class=&quot;comment-form-twitter&quot;&gt;&lt;label for=&quot;twitter&quot;&gt;twitter@&lt;/label&gt;&lt;input id=&quot;' . $custom_key_twitter . '&quot; name=&quot;' . $custom_key_twitter . '&quot; type=&quot;text&quot; value=&quot;' . $get_twitter . '&quot; size=&quot;15&quot; /&gt;&lt;/p&gt;' . &quot;\n&quot;;
}
</pre>
<p>add_comment_field でコメントの項目を足しています。</p>
<pre>
$defaults .= '&lt;p class=&quot;comment-form-comment&quot;&gt;&lt;label for=&quot;comment&quot;&gt;' . _x( 'Comment', 'noun' ) . '&lt;/label&gt;&lt;textarea id=&quot;comment&quot; name=&quot;comment&quot; cols=&quot;45&quot; rows=&quot;8&quot; aria-required=&quot;true&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;';
</pre>
<p>上記は必ず入れてください。<br />
入れないとコメントのテキストエリアが表示されません。</p>
<pre>
function add_comment_field( $fields ) {
	$fields['twitter'] = '&lt;p class=&quot;comment-form-twitter&quot;&gt;&lt;label for=&quot;twitter&quot;&gt;twitter@&lt;/label&gt;&lt;input id=&quot;twitter&quot; name=&quot;twitter&quot; type=&quot;text&quot; value=&quot;&quot; size=&quot;15&quot; /&gt;&lt;/p&gt;';
	return $fields;
}
add_filter('comment_form_default_fields','add_comment_field');
</pre>
<p>もありますが、ログインした際は表示されないので目的に合わせて変更してください。<br />
<a href="http://sauce.webnist.net/files/comment.gif"><img src="http://sauce.webnist.net/files/comment-300x278.gif" alt="" title="comment" width="300" height="278" class="aligncenter size-medium wp-image-58" /></a></p>
<pre>
add_action( 'comment_post', 'save_comment_field' );
add_action( 'edit_comment', 'save_comment_field' );
function save_comment_field( $comment_id ) {
	if ( !$comment = get_comment( $comment_id ) )
		return false;
	do_action('comment_form', $post-&gt;ID);
	$custom_key_twitter  = 'twitter';
    $get_comment_twitter = esc_attr( $_POST[$custom_key_twitter] );
    if ( &quot;&quot; == get_comment_meta( $comment_id, $custom_key_twitter )) {
        add_comment_meta( $comment_id, $custom_key_twitter, $get_comment_twitter, true ) ;
    } else if ( $get_comment_twitter != get_comment_meta( $comment_id, $custom_key_twitter )) {
        update_comment_meta( $comment_id, $custom_key_twitter, $get_comment_twitter ) ;
    } else if ( &quot;&quot; == $get_comment_twitter ) {
        delete_comment_meta( $comment_id, $custom_key_twitter ) ;
    }
	return false;
}
</pre>
<p>で commentmeta に保存します。</p>
<pre>
add_action( 'add_meta_boxes_comment', 'add_comment_field_box' );
function add_comment_field_box() {
    global $comment;
	$comment_ID = $comment-&gt;comment_ID;
    $custom_key         = 'post_reviews_date' ;
    $custom_key_twitter = 'twitter' ;
    $noncename          = $custom_key . '_noncename' ;
    $get_twitter        = esc_attr( get_comment_meta( $comment_ID, $custom_key_twitter, true ) );
    echo '&lt;input type=&quot;hidden&quot; name=&quot;' . $noncename . '&quot; id=&quot;' . $noncename . '&quot; value=&quot;' . wp_create_nonce( plugin_basename(__FILE__) ) . '&quot; /&gt;' . &quot;\n&quot;;
	echo '&lt;p class=&quot;comment-form-twitter&quot;&gt;&lt;label for=&quot;twitter&quot;&gt;twitter@&lt;/label&gt;&lt;input id=&quot;' . $custom_key_twitter . '&quot; name=&quot;' . $custom_key_twitter . '&quot; type=&quot;text&quot; value=&quot;' . $get_twitter . '&quot; size=&quot;15&quot; /&gt;&lt;/p&gt;' . &quot;\n&quot;;
}
</pre>
<p>で管理画面からのコメント編集の際にコメントに追加したボックスが表示されます。<br />
<a href="http://sauce.webnist.net/files/commentadmin.gif"><img src="http://sauce.webnist.net/files/commentadmin-264x300.gif" alt="" title="commentadmin" width="264" height="300" class="aligncenter size-medium wp-image-59" /></a></p>
<p>コメントに表示するときは comment.php 内に</p>
<pre>
wp_list_comments();
</pre>
<p>があると思うのでそれを</p>
<pre>
wp_list_comments( array( 'callback' =&gt; 'mytheme_comment' ) );
</pre>
<p>などにして、mytheme_comment の関数を読み込みます。</p>
<p>mytheme_comment の関数は</p>
<pre>
function mytheme_comment($comment, $args, $depth) {
   $GLOBALS['comment'] = $comment;
   $comment_ID = $comment-&gt;comment_ID;
   $get_twitter        = esc_attr( get_comment_meta( $comment-&gt;comment_ID, 'twitter', true ) ); ?&gt;
   &lt;li &lt;?php comment_class(); ?&gt; id=&quot;li-comment-&lt;?php comment_ID() ?&gt;&quot;&gt;
     &lt;div id=&quot;comment-&lt;?php comment_ID(); ?&gt;&quot;&gt;
      &lt;div class=&quot;comment-author vcard&quot;&gt;
         &lt;?php echo get_avatar($comment,$size='48',$default='&lt;path_to_url&gt;' ); ?&gt;

         &lt;?php printf(__('&lt;cite class=&quot;fn&quot;&gt;%s&lt;/cite&gt; &lt;span class=&quot;says&quot;&gt;says:&lt;/span&gt;'), get_comment_author_link()) ?&gt;
         &lt;?php printf(__('Twitter ID %s'), $get_twitter) ?&gt;
      &lt;/div&gt;
      &lt;?php if ($comment-&gt;comment_approved == '0') : ?&gt;
         &lt;em&gt;&lt;?php _e('Your comment is awaiting moderation.') ?&gt;&lt;/em&gt;
         &lt;br /&gt;
      &lt;?php endif; ?&gt;

      &lt;div class=&quot;comment-meta commentmetadata&quot;&gt;&lt;a href=&quot;&lt;?php echo htmlspecialchars( get_comment_link( $comment-&gt;comment_ID ) ) ?&gt;&quot;&gt;&lt;?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?&gt;&lt;/a&gt;&lt;?php edit_comment_link(__('(Edit)'),'  ','') ?&gt;&lt;/div&gt;

      &lt;?php comment_text() ?&gt;

      &lt;div class=&quot;reply&quot;&gt;
         &lt;?php comment_reply_link(array_merge( $args, array('depth' =&gt; $depth, 'max_depth' =&gt; $args['max_depth']))) ?&gt;
      &lt;/div&gt;
     &lt;/div&gt;
&lt;?php
}
</pre>
<p>等にして function.php に記入します。<br />
今回保存した項目の読み出しは</p>
<pre>
get_comment_meta( $comment-&gt;comment_ID, 'twitter', true )
</pre>
<p>で読みだしています。<br />
get_comment_meta は get_post_meta と同じような感じです。</p>
<p><a href="http://sauce.webnist.net/files/display_comment.gif"><img src="http://sauce.webnist.net/files/display_comment-300x75.gif" alt="" title="display_comment" width="300" height="75" class="aligncenter size-medium wp-image-61" /></a></p>
<p>以上、文章がおかしいですが大体の流れが分かって頂ければと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://sauce.webnist.net/2010/12/24/%e3%82%b3%e3%83%a1%e3%83%b3%e3%83%88%e3%81%ae%e9%a0%85%e7%9b%ae%e8%b6%b3%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b%e3%83%91%e3%83%b3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jpg のアップロードの画質変えちゃろ</title>
		<link>http://sauce.webnist.net/2010/12/24/jpg-%e3%81%ae%e3%82%a2%e3%83%83%e3%83%97%e3%83%ad%e3%83%bc%e3%83%89%e3%81%ae%e5%9c%a7%e7%b8%ae%e7%8e%87%e5%a4%89%e3%81%88%e3%81%a1%e3%82%83%e3%82%8d/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jpg-%25e3%2581%25ae%25e3%2582%25a2%25e3%2583%2583%25e3%2583%2597%25e3%2583%25ad%25e3%2583%25bc%25e3%2583%2589%25e3%2581%25ae%25e5%259c%25a7%25e7%25b8%25ae%25e7%258e%2587%25e5%25a4%2589%25e3%2581%2588%25e3%2581%25a1%25e3%2582%2583%25e3%2582%258d</link>
		<comments>http://sauce.webnist.net/2010/12/24/jpg-%e3%81%ae%e3%82%a2%e3%83%83%e3%83%97%e3%83%ad%e3%83%bc%e3%83%89%e3%81%ae%e5%9c%a7%e7%b8%ae%e7%8e%87%e5%a4%89%e3%81%88%e3%81%a1%e3%82%83%e3%82%8d/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 00:00:48 +0000</pubDate>
		<dc:creator>Webnist</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://sauce.webnist.net/?p=13</guid>
		<description><![CDATA[ｊpg のサムネール画像アップロード時する際画質のデフォルトの値は90になっています。jpg の画質を変える事を検索してみたら、コアファイルをいじる記事が多かったので、コアファイルをいじらずに変更できるコードを紹介します。 add_filter( 'jpeg_quality', 'child_jpeg_quality' ); function child_jpeg_quality( $jpeg_quality ) { $jpeg_quality = 100; return $jpeg_quality; } 上記の $jpeg_quality の値を変更する事でワザと劣化させて表示させる事も可能です。 例：画質100 例：画質50 例：画質10]]></description>
			<content:encoded><![CDATA[<p>ｊpg のサムネール画像アップロード時する際画質のデフォルトの値は90になっています。jpg の画質を変える事を検索してみたら、コアファイルをいじる記事が多かったので、コアファイルをいじらずに変更できるコードを紹介します。</p>
<pre>
add_filter( 'jpeg_quality', 'child_jpeg_quality' );
function child_jpeg_quality( $jpeg_quality ) {
    $jpeg_quality = 100;
    return $jpeg_quality;
}
</pre>
<p>上記の $jpeg_quality の値を変更する事でワザと劣化させて表示させる事も可能です。</p>
<p>例：画質100<br />
<a href="http://sauce.webnist.net/files/Koala1.jpg"><img src="http://sauce.webnist.net/files/Koala1-150x150.jpg" alt="" title="Koala" width="150" height="150" class="alignnone size-thumbnail wp-image-32" /></a><br />
<a href="http://sauce.webnist.net/files/Koala1.jpg"><img src="http://sauce.webnist.net/files/Koala1-300x225.jpg" alt="" title="Koala" width="300" height="225" class="alignnone size-medium wp-image-32" /></a></p>
<p>例：画質50<br />
<a href="http://sauce.webnist.net/files/Koala2.jpg"><img src="http://sauce.webnist.net/files/Koala2-150x150.jpg" alt="" title="Koala" width="150" height="150" class="alignnone size-thumbnail wp-image-34" /></a><br />
<a href="http://sauce.webnist.net/files/Koala2.jpg"><img src="http://sauce.webnist.net/files/Koala2-300x225.jpg" alt="" title="Koala" width="300" height="225" class="alignnone size-medium wp-image-34" /></a></p>
<p>例：画質10<br />
<a href="http://sauce.webnist.net/files/Koala3.jpg"><img src="http://sauce.webnist.net/files/Koala3-150x150.jpg" alt="" title="Koala" width="150" height="150" class="alignnone size-thumbnail wp-image-37" /></a><br />
<a href="http://sauce.webnist.net/files/Koala3.jpg"><img src="http://sauce.webnist.net/files/Koala3-300x225.jpg" alt="" title="Koala" width="300" height="225" class="alignnone size-medium wp-image-37" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://sauce.webnist.net/2010/12/24/jpg-%e3%81%ae%e3%82%a2%e3%83%83%e3%83%97%e3%83%ad%e3%83%bc%e3%83%89%e3%81%ae%e5%9c%a7%e7%b8%ae%e7%8e%87%e5%a4%89%e3%81%88%e3%81%a1%e3%82%83%e3%82%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>カスタムメニューを画像にする</title>
		<link>http://sauce.webnist.net/2010/11/25/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%83%a1%e3%83%8b%e3%83%a5%e3%83%bc%e3%82%92%e7%94%bb%e5%83%8f%e3%81%ab%e3%81%99%e3%82%8b/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e3%2582%25ab%25e3%2582%25b9%25e3%2582%25bf%25e3%2583%25a0%25e3%2583%25a1%25e3%2583%258b%25e3%2583%25a5%25e3%2583%25bc%25e3%2582%2592%25e7%2594%25bb%25e5%2583%258f%25e3%2581%25ab%25e3%2581%2599%25e3%2582%258b</link>
		<comments>http://sauce.webnist.net/2010/11/25/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%83%a1%e3%83%8b%e3%83%a5%e3%83%bc%e3%82%92%e7%94%bb%e5%83%8f%e3%81%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 05:00:05 +0000</pubDate>
		<dc:creator>Webnist</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://sauce.webnist.net/?p=9</guid>
		<description><![CDATA[以下をテーマ内のfunction.phpに挿入してください。 add_filter( 'the_title', 'img_nav_menu_title' ); function img_nav_menu_title($title) { if( preg_match( &#34;/\[\[(.*)\]\]/&#34;, $title, $match ) ) { $get_title = $match[1]; $get_img_url = clean_url($get_title); if($get_title == 'none') { $title = ''; } else { $get_img_dir = str_replace( get_option('home') . '/', ABSPATH, $get_img_url &#8230; <a href="http://sauce.webnist.net/2010/11/25/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%83%a1%e3%83%8b%e3%83%a5%e3%83%bc%e3%82%92%e7%94%bb%e5%83%8f%e3%81%ab%e3%81%99%e3%82%8b/">続きを読む<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>以下をテーマ内のfunction.phpに挿入してください。</p>
<pre>
add_filter( 'the_title', 'img_nav_menu_title' );
function img_nav_menu_title($title) {
	if( preg_match( &quot;/\[\[(.*)\]\]/&quot;, $title, $match ) ) {
		$get_title = $match[1];
		$get_img_url = clean_url($get_title);
		if($get_title == 'none') {
			$title = '';
		} else {
			$get_img_dir = str_replace( get_option('home') . '/', ABSPATH, $get_img_url );
			$get_size    = getimagesize( $get_img_dir );
			$get_alt     = preg_replace( &quot;/\[\[(.*)\]\]/&quot;, '', $title );
			$title = '&lt;img src=&quot;' . $get_img_url . '&quot; alt=&quot;' . $get_alt . '&quot; /&gt;';
		}
		return $title;
	} else {
		return $title;
	}
}
</pre>
<p>ナビゲーションラベルに<br />
ラベル名[[画像のURL]]<br />
を入力すると画像が表示されます。<br />
ラベル名[[none]]<br />
とするとタイトルは表示されません。<br />
※<a title="ウィジェットタイトルに画像を入れる" href="http://sauce.webnist.net/2010/11/25/%e3%82%a6%e3%82%a3%e3%82%b8%e3%82%a7%e3%83%83%e3%83%88%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e3%81%ab%e7%94%bb%e5%83%8f%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/">前回のウィジェットタイトルに画像を入れる</a>をしている場合は、</p>
<pre>
add_filter( 'the_title', 'img_widget_title' );
</pre>
<p>を追加してもらえれば使用できます。</p>
<p>後はCSSを調整して終了です。</p>
]]></content:encoded>
			<wfw:commentRss>http://sauce.webnist.net/2010/11/25/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e3%83%a1%e3%83%8b%e3%83%a5%e3%83%bc%e3%82%92%e7%94%bb%e5%83%8f%e3%81%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ウィジェットタイトルに画像を入れる</title>
		<link>http://sauce.webnist.net/2010/11/25/%e3%82%a6%e3%82%a3%e3%82%b8%e3%82%a7%e3%83%83%e3%83%88%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e3%81%ab%e7%94%bb%e5%83%8f%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e3%2582%25a6%25e3%2582%25a3%25e3%2582%25b8%25e3%2582%25a7%25e3%2583%2583%25e3%2583%2588%25e3%2582%25bf%25e3%2582%25a4%25e3%2583%2588%25e3%2583%25ab%25e3%2581%25ab%25e7%2594%25bb%25e5%2583%258f%25e3%2582%2592%25e5%2585%25a5%25e3%2582%258c%25e3%2582%258b</link>
		<comments>http://sauce.webnist.net/2010/11/25/%e3%82%a6%e3%82%a3%e3%82%b8%e3%82%a7%e3%83%83%e3%83%88%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e3%81%ab%e7%94%bb%e5%83%8f%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 04:56:15 +0000</pubDate>
		<dc:creator>Webnist</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://sauce.webnist.net/?p=6</guid>
		<description><![CDATA[以下をテーマ内のfunction.phpに挿入してください。 add_filter( 'widget_title', 'img_widget_title' ); function img_widget_title($title) { if( preg_match( &#34;/\[\[(.*)\]\]/&#34;, $title, $match ) ) { $get_title = $match[1]; $get_img_url = clean_url($get_title); if($get_title == 'none') { $title = ''; } else { $get_img_dir = str_replace( get_option('home') . '/', ABSPATH, $get_img_url &#8230; <a href="http://sauce.webnist.net/2010/11/25/%e3%82%a6%e3%82%a3%e3%82%b8%e3%82%a7%e3%83%83%e3%83%88%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e3%81%ab%e7%94%bb%e5%83%8f%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/">続きを読む<span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>以下をテーマ内のfunction.phpに挿入してください。</p>
<pre>
add_filter( 'widget_title', 'img_widget_title' );
function img_widget_title($title) {
	if( preg_match( &quot;/\[\[(.*)\]\]/&quot;, $title, $match ) ) {
		$get_title = $match[1];
		$get_img_url = clean_url($get_title);
		if($get_title == 'none') {
			$title = '';
		} else {
			$get_img_dir = str_replace( get_option('home') . '/', ABSPATH, $get_img_url );
			$get_size    = getimagesize( $get_img_dir );
			$get_alt     = preg_replace( &quot;/\[\[(.*)\]\]/&quot;, '', $title );
			$title = '&lt;img src=&quot;' . $get_img_url . '&quot; alt=&quot;' . $get_alt . '&quot; ' . $get_size[3] . ' /&gt;';
		}
		return $title;
	} else {
		return $title;
	}
}
</pre>
<p>ウィジェットのタイトルに<br />
タイトル[[画像のURL]]<br />
を入力すると画像が表示されます。<br />
タイトル[[none]]<br />
とするとタイトルは表示されません。</p>
]]></content:encoded>
			<wfw:commentRss>http://sauce.webnist.net/2010/11/25/%e3%82%a6%e3%82%a3%e3%82%b8%e3%82%a7%e3%83%83%e3%83%88%e3%82%bf%e3%82%a4%e3%83%88%e3%83%ab%e3%81%ab%e7%94%bb%e5%83%8f%e3%82%92%e5%85%a5%e3%82%8c%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

