<?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>Little.ws &#187; php</title>
	<atom:link href="http://little.ws/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://little.ws</link>
	<description>web制作とかcssとかデザインとか色々～な覚え書き</description>
	<lastBuildDate>Sat, 04 Feb 2012 07:27:16 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>wordpress：親カテゴリと子カテゴリのID取得（兄弟カテゴリ？）</title>
		<link>http://little.ws/200906/206.html</link>
		<comments>http://little.ws/200906/206.html#comments</comments>
		<pubDate>Mon, 08 Jun 2009 03:00:30 +0000</pubDate>
		<dc:creator>chibi</dc:creator>
				<category><![CDATA[Wordpress応用]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpressタグ]]></category>
		<category><![CDATA[人にやさしく]]></category>

		<guid isPermaLink="false">http://little.ws/?p=206</guid>
		<description><![CDATA[調べても無かったので覚え書き程度に。 先日は、wordpress:親カテゴリが同じな子カテゴリの一覧表示でリスト表示させたのですが、IDが欲しい！というときのために。。 まずはこの前と同じ。。。 ここまでで、親カテゴリの&#8230;]]></description>
			<content:encoded><![CDATA[<p>調べても無かったので覚え書き程度に。<br />
先日は、<a href="http://little.ws/200906/204.html" class="liinternal">wordpress:親カテゴリが同じな子カテゴリの一覧表示</a>でリスト表示させたのですが、IDが欲しい！というときのために。。<br />
<span id="more-206"></span><br />
まずはこの前と同じ。。。</p>
<pre class="brush: php; title: ; notranslate">
/* 現在のカテゴリの取得 */
$cat_now = get_the_category();
$cat_now = $cat_now[0];

/*親カテゴリのID取得*/

$parent_id = $cat_now-&gt;category_parent;
</pre>
<p>ここまでで、親カテゴリのIDを取得します。<br />
ちなみに超初歩的なことですが、get_the_categoryはループ内で使うタグですので。。。<br/><br />
あとはget_category_childrenというタグを使用します。<br />
このタグに関してはリファレンスが無かったりするので・・<br />
ソースは</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php $cat_children = get_category_children($parent_id); ?&gt;
</pre>
<p>こんな感じです。<br />
get_category_childrenに関しては、<br/><br />
<strong>get_category_children(親カテゴリーID, before,after)</strong><br/><br />
以上の表記になります。<br />
デフォルトでは。IDの間に『/』が入りますので、以上の表記をいじって変える感じです。<br />
これで兄弟カテゴリ（姉妹カテゴリ）のID取得できます。</p>
]]></content:encoded>
			<wfw:commentRss>http://little.ws/200906/206.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress:カスタムフィールドを使いやすく！その２</title>
		<link>http://little.ws/200903/193.html</link>
		<comments>http://little.ws/200903/193.html#comments</comments>
		<pubDate>Wed, 18 Mar 2009 03:35:25 +0000</pubDate>
		<dc:creator>chibi</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpressタグ]]></category>
		<category><![CDATA[カスタムフィールド]]></category>
		<category><![CDATA[人にやさしく]]></category>

		<guid isPermaLink="false">http://little.ws/?p=193</guid>
		<description><![CDATA[カスタムフィールドを呼び出す方法、wordpress:Get Custom Field Valuesでプラグインを使用して呼び出す方法は書いていたみたいです。 これ、先の記事（wordpress:カスタムフィールドを使い&#8230;]]></description>
			<content:encoded><![CDATA[<p>カスタムフィールドを呼び出す方法、<a href="http://little.ws/200901/103.html" class="liinternal">wordpress:Get Custom Field Values</a>でプラグインを使用して呼び出す方法は書いていたみたいです。<br />
これ、先の記事（<a href="http://little.ws/200903/182.html" class="liinternal">wordpress:カスタムフィールドを使いやすく！</a>）の続きですので、先にそっちを読んだ方がいいです。<br/><br />
でも、今回はプラグインを使用せずに呼び出しましょう。<br />
<span id="more-193"></span><br />
前回の記事で、サムネイル表示用のメタボックスを作成したので、<br />
それを呼び出してあげましょう。<br />
先にソース書きます！</p>
<pre class="brush: php; title: ; notranslate">
&lt;div class=&quot;eximg&quot;&gt;
	&lt;?php
		$smallimg = get_post_meta($post-&gt;ID, &quot;smallimg_value&quot;, true);
	?&gt;

   &lt;p&gt;
	&lt;?php if($smallimg !== '') { ?&gt;
	&lt;a title=&quot;&lt;?php the_title(); ?&gt;&quot; href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;img style=&quot;width:100px; height:100px;&quot; src=&quot;&lt;?php echo $smallimg; ?&gt;&quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot;/&gt;&lt;/a&gt;
	&lt;?php } else { ?&gt;
	&lt;a title=&quot;&lt;?php the_title(); ?&gt;&quot; href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;img src=&quot;&lt;?php bloginfo('template_url'); ?&gt;/images/postsmall.jpg&quot; style=&quot;width:100px; height:100px; &quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot;/&gt;&lt;/a&gt;
    &lt;?php } ?&gt;
   &lt;/p&gt;
&lt;/div&gt;
</pre>
<p>簡単に説明すると、メタボックスに入力した画像を読み込み表示プラス記事へのリンクです。<br />
んで、もしメタボックスに何も入力されていないときは、テーマフォルダ内の/images/postsmall.jpgという画像を表示させて記事へのリンクを張ります。<br />
ただ、これは先の記事で書いたstdの部分にデフォルトの画像として入力しておいてあげればすむことなのですが、<br />
万が一空白にしてしまったときのための保険みたいなモノとして書いてあげています。<br />
100pxの値は任意の値に変えてあげて下さい。</p>
]]></content:encoded>
			<wfw:commentRss>http://little.ws/200903/193.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>サイドバー・アーカイブの日付フォーマット変更</title>
		<link>http://little.ws/200812/7.html</link>
		<comments>http://little.ws/200812/7.html#comments</comments>
		<pubDate>Fri, 26 Dec 2008 07:26:54 +0000</pubDate>
		<dc:creator>chibi</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://little.ws/?p=7</guid>
		<description><![CDATA[wordpressの日付英語表記でプラグインを導入したら、 で表示されるサイドバーの月別アーカイブの表記が 2008年 December とかなった！！ クライアントが、日付表記をコメントのとこ以外「20081226」み&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://little.ws/200812/3/" class="liinternal">wordpressの日付英語表記</a>でプラグインを導入したら、</p>
<pre class="brush: php; title: ; notranslate">&lt;?php wp_get_archives(’type=monthly’); ?&gt;</pre>
<p>で表示されるサイドバーの月別アーカイブの表記が<br />
2008年 December<br />
とかなった！！<br />
クライアントが、日付表記をコメントのとこ以外「20081226」みたいに<br />
月とか/とか無しで表記して欲しいとかいうので、直すことに・・。<br />
ここの表記はwp-includes/general-template.phpの767行目をいぢるしかなさそう。<br />
めんどいけど、やるかーということで。<br />
767行目あたり。（ver2.7のとき）</p>
<pre class="brush: php; title: ; notranslate">$text = sprintf(__('%1$s %2$d'), $wp_locale-&gt;get_month($arcresult-&gt;month), $arcresult-&gt;year);</pre>
<p>を</p>
<pre class="brush: php; title: ; notranslate">$text = sprintf(('%04d%02d'), $arcresult-&gt;year, $arcresult-&gt;month);</pre>
<p>に書き換えて表示を<br />
200812<br />
に変更。</p>
]]></content:encoded>
			<wfw:commentRss>http://little.ws/200812/7.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpressの日付英語表記</title>
		<link>http://little.ws/200812/158.html</link>
		<comments>http://little.ws/200812/158.html#comments</comments>
		<pubDate>Fri, 26 Dec 2008 05:02:32 +0000</pubDate>
		<dc:creator>chibi</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://little.ws/?p=3</guid>
		<description><![CDATA[PHPの日付文法を使って、 こう書いても、はき出されるのは 12 月26th,2008 at 1:00 PM 月の表示が・・・こんなのダサイので、 locale.phpをいじって解決。 小粋空間さん、いつもありがとう。 &#8230;]]></description>
			<content:encoded><![CDATA[<p>PHPの日付文法を使って、</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php comment_date(’MjS,Y’) ?&gt;
</pre>
<p>こう書いても、はき出されるのは<br />
12 月26th,2008 at 1:00 PM<br />
月の表示が・・・こんなのダサイので、<br />
locale.phpをいじって解決。<br />
小粋空間さん、いつもありがとう。<br />
<a href="http://www.koikikukan.com/archives/2007/03/14-003001.php" class="liexternal">http://www.koikikukan.com/archives/2007/03/14-003001.php</a></p>
<p>5分後追記：<br />
どうやらバージョンが違うとまた編集しなきゃいけないっぽいので、<br />
めんどくさいから、プラグインで済ましちゃいます。<br />
<a href="http://www.feelwct.jp/staffblog/2008/02/wordpress.html" class="liexternal">W.C.T_FEEL：日本語版WordPressの曜日・月表記を英語にする方法</a></p>
<p>再び追記：<br />
これ、poeditでwp-content\languages\ja.poの9562行（ver2.7の時）以降をいぢってもいいと思う。<br />
poeditならいじって保存したらmoファイルが勝手に出来るので、それをまたUPしちゃえばいいし。<br />
ただし、じぇねらるーなファイルなので、あんまりおすすめはしないけど。</p>
]]></content:encoded>
			<wfw:commentRss>http://little.ws/200812/158.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

