<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>はなとみかん &#187; カスタマイズ</title>
	<atom:link href="http://hanatomikan.com/tag/customization/feed" rel="self" type="application/rss+xml" />
	<link>http://hanatomikan.com</link>
	<description>「はなとみかん」はWebデザイン、ホームページ作成、ネットショップ（ショップサーブ、楽天市場、Yahoo!ストア）のデザイン・カスタマイズなどをしているフリーランスのWebデザイナーです。</description>
	<lastBuildDate>Tue, 04 Jan 2011 01:16:14 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://hanatomikan.com/tag/customization/feed" />
		<item>
		<title>[WP]同じカテゴリの前後の記事へリンク</title>
		<link>http://hanatomikan.com/blog/wordpress/%e5%90%8c%e3%81%98%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%81%ae%e5%89%8d%e5%be%8c%e3%81%ae%e8%a8%98%e4%ba%8b%e3%81%b8%e3%83%aa%e3%83%b3%e3%82%af</link>
		<comments>http://hanatomikan.com/blog/wordpress/%e5%90%8c%e3%81%98%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%81%ae%e5%89%8d%e5%be%8c%e3%81%ae%e8%a8%98%e4%ba%8b%e3%81%b8%e3%83%aa%e3%83%b3%e3%82%af#comments</comments>
		<pubDate>Fri, 12 Feb 2010 03:38:28 +0000</pubDate>
		<dc:creator>はなとみかん</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[カスタマイズ]]></category>

		<guid isPermaLink="false">http://hanatomikan.com/?p=759</guid>
		<description><![CDATA[Photologを作った時に前後の記事へのリンクにBlogカテゴリの記事も混ざるのが気になったので、同じカテゴリ間でリンクさせる方法を探してみたら、めちゃくちゃ簡単で驚いたｗ 参考サイト WordPress Tips : [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://hanatomikan.com/wp-content/uploads/nextlink.jpg" title="同じカテゴリの前後の記事へリンク" width="536" height="225" class="alignnone size-full wp-image-760" /></p>
<p>Photologを作った時に前後の記事へのリンクにBlogカテゴリの記事も混ざるのが気になったので、同じカテゴリ間でリンクさせる方法を探してみたら、めちゃくちゃ簡単で驚いたｗ</p>
<h2>参考サイト</h2>
<ul>
<li><a href="http://tomokame.moo.jp/archives/612">WordPress Tips : いまいるカテゴリの前後の記事へ移動する｜ともかめ亭</a></li>
<li><a href="http://wpdocs.sourceforge.jp/%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%BF%E3%82%B0/previous_post_link">テンプレートタグ/previous post link｜Codex</a></li>
</ul>
<h2>テンプレートタグ</h2>
<p>前の記事（古い記事）へのリンク</p>
<pre class="brush: php; title: ; notranslate">&lt;?php previous_post_link('format', 'link', in_same_cat, 'excluded_categories'); ?&gt;</pre>
<p>後の記事（新しい記事）へのリンク</p>
<pre class="brush: php; title: ; notranslate">&lt;?php next_post_link('format', 'link', in_same_cat, 'excluded_categories'); ?&gt;</pre>
<h3>パラメータ</h3>
<ul>
<li><strong>format</strong><br />
リンク文字列の書式</li>
<li><strong>link</strong><br />
表示するリンクのテキスト</li>
<li><strong>in_same_cat</strong><br />
同じカテゴリの前後記事へリンクさせるかどうかを指定。これをTRUEにすると同じカテゴリ間のリンクになります。<br />
デフォルト：FALSE</li>
<li><strong>excluded_categories</strong><br />
表示させたくない記事のカテゴリーID</li>
</ul>
<p>ちゃんとパラメータが用意されてたんですね～</p>
<p>「in_same_cat」を指定するだけで良かったとは。目からウロコｗ</p>
]]></content:encoded>
			<wfw:commentRss>http://hanatomikan.com/blog/wordpress/%e5%90%8c%e3%81%98%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%81%ae%e5%89%8d%e5%be%8c%e3%81%ae%e8%a8%98%e4%ba%8b%e3%81%b8%e3%83%aa%e3%83%b3%e3%82%af/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://hanatomikan.com/blog/wordpress/%e5%90%8c%e3%81%98%e3%82%ab%e3%83%86%e3%82%b4%e3%83%aa%e3%81%ae%e5%89%8d%e5%be%8c%e3%81%ae%e8%a8%98%e4%ba%8b%e3%81%b8%e3%83%aa%e3%83%b3%e3%82%af" />
	</item>
		<item>
		<title>写メールとWordPressとTwitter</title>
		<link>http://hanatomikan.com/blog/wordpress/%e5%86%99%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%a8wordpress%e3%81%a8twitter</link>
		<comments>http://hanatomikan.com/blog/wordpress/%e5%86%99%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%a8wordpress%e3%81%a8twitter#comments</comments>
		<pubDate>Tue, 26 Jan 2010 10:49:15 +0000</pubDate>
		<dc:creator>はなとみかん</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Ktai Entry]]></category>
		<category><![CDATA[Photolog]]></category>
		<category><![CDATA[QF-GetThumb]]></category>
		<category><![CDATA[Twitter Tools]]></category>
		<category><![CDATA[カスタマイズ]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://hanatomikan.com/?p=753</guid>
		<description><![CDATA[携帯電話の写メールとWordPressとTwitterを連携させてPhotologを作ってみました。]]></description>
			<content:encoded><![CDATA[<p><img src="http://hanatomikan.com/wp-content/uploads/photolog_start.jpg" title="Photologはじめました" width="536" height="225" class="alignnone size-full wp-image-754" /></p>
<p>最近、Twitterをはじめるお客様が多くなってきて、いろいろと相談を受けることが多くなってきました。</p>
<p>この間も「Twitterって画像付けれるの？」と聞かれ<a href="http://yfrog.com/">yfrog</a>を紹介したのですが、そういえば、WordPressでも同じようなことができるな～と後で気づきました＾＾；</p>
<p>ということで、携帯電話の写メールとWordPressとTwitterを連携させて<a href="http://hanatomikan.com/category/photolog">Photolog</a>を作ってみました。</p>
<ol>
<li>携帯電話から写メールを送る</li>
<li>WordPressが受け取り記事にする</li>
<li>記事が公開されるとTwitterに通知</li>
</ol>
<p>写メールを送った後の2、3は自動で行われます。</p>
<h2>使用したプラグイン</h2>
<ul>
<li><a href="http://wppluginsj.sourceforge.jp/ktai_entry/"><strong>Ktai Entry</strong> (メール投稿プラグイン)</a><br />
携帯電話からメールを送って記事を投稿できるようにします。</li>
<li><a href="http://la-passeggiata.com/?p=331"><strong>QF-GetThumb</strong></a><br />
記事内の画像からサムネイルを自動生成するプラグイン。</li>
<li><strong><a href="http://wordpress.org/extend/plugins/twitter-tools/">Twitter Tools</a></strong><br />
新規投稿があればTwitterに通知します。<br />
私は以前から使っていたのでこのプラグインを使っていますが、<strong><a href="http://wppluginsj.sourceforge.jp/simple-tweet/">Simple Tweet</a></strong>も国産プラグインなので使いやすいと思います。</li>
</ul>
<h2>Photolog用のテンプレートを作る</h2>
<p>ギャラリーっぽいテンプレートを作ります。</p>
<p>テンプレートのループ部分はこんな感じです。</p>
<pre class="brush: php; highlight: [3]; title: ; notranslate">&lt;div id=&quot;photolog&quot;&gt;
&lt;ul&gt;
&lt;?php query_posts($query_string.'&amp;posts_per_page=15'); ?&gt;
&lt;?php if(have_posts()):while(have_posts()):the_post(); ?&gt;
&lt;li id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title();?&gt;&quot;&gt;&lt;img src=&quot;&lt;?php echo the_qf_get_thumb_one('num=0&amp;height=150&amp;crop_w=150&amp;tag=0'); ?&gt;&quot; alt=&quot;&lt;?php the_title();?&gt;&quot; class=&quot;fadeImg&quot; /&gt;&lt;em&gt;&lt;?php the_title();?&gt;&lt;/em&gt;&lt;/a&gt;&lt;span&gt;&lt;?php the_tags( 'Tags: ' , ', '); ?&gt;&lt;/span&gt;&lt;/li&gt;
&lt;?php endwhile; endif ?&gt;
&lt;/ul&gt;
&lt;!-- / #photolog --&gt;&lt;/div&gt;</pre>
<p>基本の投稿数の表示は5件なのですが、Photologだけは5件だと少ないので、ループタグの前に<code>query_posts($query_string.'&amp;posts_per_page=15');</code>と書いて表示数を15件にしています。</p>
<ul>
<li>参考サイト：<a href="http://blog.daichifive.com/archives/164">wordpressでテンプレート毎に記事表示件数を変える</a></li>
</ul>
<p>今までこのサイトでのサムネイル画像はカスタムフィールドで指定したものを表示していたけど、Photologは写メを送るだけで済ませるので、サムネイルを自動生成するプラグイン<a href="http://la-passeggiata.com/?p=331"><strong>QF-GetThumb</strong></a>を使うことにしました。</p>
<p>今回追加したQF-GetThumbは国産プラグインなのでとても使いやすかったｗ<br />
詳しい使い方は配布サイトをご覧くださいませ。</p>
<p>このサイトではカテゴリとしてPhotologを作成しましたが、Photolog用に新たにWordPressを用意しても良いと思います。</p>
<h2>Photologテーマ</h2>
<p>すぐにPhotologを作りたい方にはこちらのような素敵なPhotologテーマもありますよ(*´∀｀)</p>
<p><a href="http://hanatomikan.com/wp-content/uploads/lomohmds.jpg"><img src="http://hanatomikan.com/wp-content/uploads/lomohmds-536x335.jpg" title="lomohmds" width="536" height="335" class="alignnone size-medium wp-image-755" /></a></p>
<p><strong>lomohmds</strong>：<a href="http://hm-blog.jugem.jp/?eid=132">ダウンロード</a>、<a href="http://lomo.hmds.jp/">Demo</a></p>
<p><a href="http://hanatomikan.com/wp-content/uploads/photo-biyori.jpg"><img src="http://hanatomikan.com/wp-content/uploads/photo-biyori-536x335.jpg" title="Photo-Biyori" width="536" height="335" class="alignnone size-medium wp-image-756" /></a></p>
<p><strong>Photo-Biyori</strong>：<a href="http://everydays.hassii.com/photo-biyori">ダウンロード</a>、<a href="http://pb.hassii.com/en/">Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hanatomikan.com/blog/wordpress/%e5%86%99%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%a8wordpress%e3%81%a8twitter/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://hanatomikan.com/blog/wordpress/%e5%86%99%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%a8wordpress%e3%81%a8twitter" />
	</item>
		<item>
		<title>Tweet Thisボタンをつけてみた</title>
		<link>http://hanatomikan.com/blog/wordpress/tweet-this%e3%83%9c%e3%82%bf%e3%83%b3%e3%82%92%e3%81%a4%e3%81%91%e3%81%a6%e3%81%bf%e3%81%9f</link>
		<comments>http://hanatomikan.com/blog/wordpress/tweet-this%e3%83%9c%e3%82%bf%e3%83%b3%e3%82%92%e3%81%a4%e3%81%91%e3%81%a6%e3%81%bf%e3%81%9f#comments</comments>
		<pubDate>Tue, 19 Jan 2010 08:37:44 +0000</pubDate>
		<dc:creator>はなとみかん</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[カスタマイズ]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://hanatomikan.com/?p=708</guid>
		<description><![CDATA[なんとなくTweet Thisボタンを付けてみたくなって設置するまでの長い道のり？のお話ｗ結局最後は・・・]]></description>
			<content:encoded><![CDATA[<p><img src="http://hanatomikan.com/wp-content/uploads/tweet_this225.gif" title="つぶやいてみる？" width="225" height="225" class="alignleft size-full wp-image-725" />Twitterユーザーが増えた今日この頃、ブログやニュースサイトに「Tweet This」ボタンが設置されているのをよく見るようになりました。</p>
<p>気になった記事についてスグに「つぶやける」のは便利ですよね。</p>
<p>私はたまにブクマ代わりに使ったりします。</p>
<p>で、これをこのサイトにも付けて見たくなったわけです。大した情報もないけど（爆）</p>
<h2>WPプラグインを探してみる</h2>
<p>WordPressを使っているのでまずはプラグインを探してみました。</p>
<ul>
<li><a href="http://richardxthripp.thripp.com/tweet-this">Tweet This</a></li>
<li><a href="http://wppluginsj.sourceforge.jp/simple-tweet/">Simple Tweet</a></li>
</ul>
<p>この２つのプラグインが使いやすそうだったのでインストールしてみました。<br />
両方ともTweet Thisボタンの設置だけじゃなく、ブログに新規投稿した時にTwitterに自動でtweetされる機能があります。<br />
お得ですｗ</p>
<h3>Tweet Thisについて</h3>
<p>使い方は簡単で、インストールして管理画面で設定を行えば勝手に記事の末尾にTweet Thisボタンが追加されます。<br />
タグの設置をしなくて良いのはメチャ簡単で◎！</p>
<p>でも私は勝手に入れられたくないんです！（わがままｗ）</p>
<p>多分、自分で任意の場所に設置できるんだろうけど、英語を読み解くのがおっくうになって挫折。<br />
（英語はメチャ苦手ｗｗ）</p>
<h3>Simple Tweetについて</h3>
<p><a href="http://dogmap.jp/">をかもと</a>さんが作ったとてもシンプルで使いやすいプラグインです。<br />
何より日本語が一番！</p>
<p>メインは「新規投稿した時にTwitterに自動でtweetされる」機能、Tweet Thisボタンはサブ機能なんですよね。</p>
<p>メイン機能は既にTwitter Toolsにあるので、同じ機能を持ったプラグインをいくつも入れるのはイヤ<br />
（わがままｗｗ）</p>
<p>ということで、両プラグインは今回は使用見送りとなりました（爆）</p>
<h2>JSを試してみる</h2>
<p>プラグインを検索している時にJSを使ったTweet Thisボタンを見つけたので試してみました。</p>
<ul>
<li><a href="http://ringoon.jp/2009/10/16/bitly-api-javascript-twitter.html">bitly API (javascript) を使ってTwitterボタンを設置する方法まとめ</a></li>
</ul>
<p>お！なかなかいい感じ♪<br />
<a href="http://bit.ly/">bitly</a>はユーザー登録してあるから丁度いいかも～♪</p>
<p>期待を胸に試してみたのですが記事にあるようにJSの後ろの方を</p>
<pre class="brush: jscript; title: ; notranslate">window.open(url, &quot;_blank&quot;);</pre>
<p>とするとポップアップブロックされてしまってちょっと不便。残念(´･ω･`)<br />
チョチョイとソースを直してしまうような知識ナシ！</p>
<h2>最後はやっぱり原点に戻る！</h2>
<p>これまたプラグインを検索していて見つけたサイトを参考にPHPに挑戦。</p>
<ul>
<li><a href="http://coliss.com/articles/blog/wordpress/wordpress-15-snippets-for-developers.html">WordPressをちょちょいと使いやすくする15のスニペット｜コリス</a></li>
</ul>
<p>そのものズバリがココにありました！</p>
<pre class="brush: php; title: ; notranslate">&lt;a href=&quot;http://twitter.com/home?status=I just read &lt;?php the_permalink(); ?&gt;&quot; title=&quot;Send this page to Twitter!&quot; target=&quot;_blank&quot;&gt;Tweet This!&lt;/a&gt;</pre>
<p>こんなに簡単なことだったとは（；^ω^）<br />
ここまでの道のりは長かった・・・（遠回りしすぎｗｗ）</p>
<p>でも少しわがままを言うと、<code>the_permalink()</code>のままだとURLが長い・・・</p>
<h3>そこで一工夫</h3>
<p>大してPHPの知識があるわけじゃない無いけどがんばってみました！これも勉強。</p>
<ul>
<li><a href="http://dogmap.jp/2008/11/06/post-to-twitter/">PHP で Twitter に投稿｜dogmap.jp</a></li>
</ul>
<p>Simple Tweetの作者<a href="http://dogmap.jp/">をかもと</a>さんとこで紹介されている「ショートURLを取得する方法」を使います。</p>
<pre class="brush: php; title: ; notranslate">$api_url  = &quot;http://tinyurl.com/api-create.php?url=&quot;;
$url = &quot;http://example.com/&quot;;   // 変換したい URL
$result = @file_get_contents( $api_url.$url );</pre>
<p><del datetime="2010-05-05T10:49:37+00:00">参考サイトでは<a href="http://tinyurl.com/">TinyURL.com</a>を使っていますが、Twitter Toolsで使っている<a href="http://bit.ly/">bitly</a>に変更。</del><br />
（なんとなく統一したい気分だったのでｗ）</p>
<p><span style="color:#FF0000;">単純に<code>http://bit.ly/api?url=</code>に変更するだけでは動かなくなったので、下記の記事を参考にfunctions.phpの記述を変更しました。（2010年5月5日）</span></p>
<ul>
<li><a href="http://blog.kechol.net/articles/articles/using-bitly-api-to-shorten-url.html">PHPでbit.lyのAPIを使って自分のサイトで短縮URLを使えるようにしてみる</a></li>
</ul>
<p>「yourAccountName」と「yourApiKey」部分は<a href="http://bit.ly/">bitly</a>に登録しているアカウント名と配布されているAPIキーに変更してください。</p>
<p>functions.phpに下記を追加。</p>
<pre class="brush: php; title: ; notranslate">function tweet_this_short_url() {
$long_url = get_permalink();
$req = &quot;http://api.bit.ly/shorten?login=yourAccountName&amp;apiKey=yourApiKey&amp;version=2.0.1&amp;longUrl=&quot;.$long_url;
	$contents = file_get_contents($req);
	if(isset($contents)) {
		$url = json_decode($contents, true);
	}
echo $url['results'][$long_url]['shortUrl'];
}</pre>
<p>変更前</p>
<pre><del datetime="2010-05-05T10:49:37+00:00">function tweet_this_short_url() {
	$api_url  = "http://bit.ly/api?url=";
	$url = get_permalink();
	$result = @file_get_contents( $api_url.$url );
	echo $result;
}</del></pre>
<p>single.phpに下記を追加。<br />
設置場所はループ内のお好きなところへどうぞ。</p>
<pre class="brush: php; title: ; notranslate">&lt;a href=&quot;http://twitter.com/home/?status=&lt;?php the_title(); ?&gt;｜&lt;?php bloginfo('name'); ?&gt; &lt;?php tweet_this_short_url(); ?&gt;&quot; title=&quot;Twitterでつぶやく&quot;&gt;Twitterでつぶやく&lt;/a&gt;</pre>
<p>これで思い通りの<strong>Tweet Thisが完成！</strong><br />
このサイトではテキスト部分をアイコンにしています。お好みで変更してください(´∀｀)</p>
<p>WordPressを使ってると何でもプラグインに頼ってしまうけど、今回のようにプラグインにしなくても簡単に出来ちゃうことって多いんだろうなぁ。<br />
あぁ、PHPをもっと自由自在に使えるようになりたい！</p>
]]></content:encoded>
			<wfw:commentRss>http://hanatomikan.com/blog/wordpress/tweet-this%e3%83%9c%e3%82%bf%e3%83%b3%e3%82%92%e3%81%a4%e3%81%91%e3%81%a6%e3%81%bf%e3%81%9f/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://hanatomikan.com/blog/wordpress/tweet-this%e3%83%9c%e3%82%bf%e3%83%b3%e3%82%92%e3%81%a4%e3%81%91%e3%81%a6%e3%81%bf%e3%81%9f" />
	</item>
	</channel>
</rss>

