<?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>Beabo &#187; WordPress</title>
	<atom:link href="http://beabo.net/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://beabo.net</link>
	<description>XOOPS Cubeモジュール制作とWordPressのカスタマイズはお任せ下さい</description>
	<lastBuildDate>Mon, 26 Apr 2010 09:50:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPressの最新の記事から画像を一覧表示する</title>
		<link>http://beabo.net/2009/02/wordpress%e3%81%ae%e6%9c%80%e6%96%b0%e3%81%ae%e8%a8%98%e4%ba%8b%e3%81%8b%e3%82%89%e7%94%bb%e5%83%8f%e3%82%92%e4%b8%80%e8%a6%a7%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b/</link>
		<comments>http://beabo.net/2009/02/wordpress%e3%81%ae%e6%9c%80%e6%96%b0%e3%81%ae%e8%a8%98%e4%ba%8b%e3%81%8b%e3%82%89%e7%94%bb%e5%83%8f%e3%82%92%e4%b8%80%e8%a6%a7%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 10:37:37 +0000</pubDate>
		<dc:creator>hiro1173</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://beabo.net/?p=111</guid>
		<description><![CDATA[WordPressの記事から、記事からサムネイル画像を取り出して表示させたくて以前は、プラグインを作っていたのですがもっとシンプルに表示させる方法が見つかったので紹介します。
表示させたい場所へテンプレートへ以下のコード [...]]]></description>
			<content:encoded><![CDATA[<p>WordPressの記事から、記事からサムネイル画像を取り出して表示させたくて以前は、プラグインを作っていたのですがもっとシンプルに表示させる方法が見つかったので紹介します。</p>
<p>表示させたい場所へテンプレートへ以下のコードを追加します。</p>
<p>記事の中で複数の画像を使っていても、1つの画像を表示します。このサイトでもサイドバーで利用しています。</p>
<p>&amp;lt;?php<br />
query_posts(&#8217;showposts=10&#8242;);<br />
if ( have_posts() ) : while ( have_posts() ) : the_post();<br />
$files = get_children(&quot;post_parent=$id&amp;amp;post_type=attachment&amp;amp;post_mime_type=image&quot;);<br />
if (!empty($files)){<br />
$keys = array_keys($files);<br />
$num=$keys[0];<br />
$thumb=wp_get_attachment_thumb_url($num);<br />
print &#8216;&amp;lt;a href=&quot;&#8217; . clean_url(get_permalink()) . &#8216;&quot; title=&quot;&#8217; .the_title_attribute(&#8216;echo=0&#8242;) . &#8216;&quot;&amp;gt;&amp;lt;img src=&quot;&#8217; . clean_url($thumb) .&#8217;&quot; width=&quot;80&quot; height=&quot;80&quot; alt=&quot;&#8217; . the_title_attribute(&#8216;echo=0&#8242;) . &#8216;&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#8217; . &quot;\n&quot;;<br />
}<br />
endwhile;else:<br />
endif;<br />
?&amp;gt;</p>
<p>query_posts()のshowposts値を変更すると表示する記事の件数を指定出来ます。</p>
<p>img srcの部分の画像のサイズは、利用しているWordPressの設定で変わるので、お使いの環境に合わせて変更してください。</p>
<p><strong>追記</strong></p>
<p><a href="http://www.yuriko.net/arc/2009/02/14/html-escape/">Yuriko.Net さんよりご指摘</a>いただいたので、書いていたこの部分を</p>
<p>print &quot;&amp;lt;a href=\&quot;&quot;.get_permalink().&quot;\&quot; title=\&quot;$post-&amp;gt;post_title\&quot;&amp;gt;&amp;lt;img src=\&quot;$thumb\&quot; width=\&quot;80\&quot; height=\&quot;80\&quot; alt=\&quot;$post-&amp;gt;post_title\&quot; /&amp;gt;&amp;lt;/a&amp;gt;\n&quot;;</p>
<p>と変更いたしました。</p>
<p>print &#8216;&amp;lt;a href=&quot;&#8217; . clean_url(get_permalink()) . &#8216;&quot; title=&quot;&#8217; .the_title_attribute(&#8216;echo=0&#8242;) . &#8216;&quot;&amp;gt;&amp;lt;img src=&quot;&#8217; . clean_url($thumb) .&#8217;&quot; width=&quot;80&quot; height=&quot;80&quot; alt=&quot;&#8217; . the_title_attribute(&#8216;echo=0&#8242;) . &#8216;&quot; /&amp;gt;&amp;lt;/a&amp;gt;&#8217; . &quot;\n&quot;;</p>
<p>確かにHTMLエスケープしてませんでした。ありがとうございました。</p>
]]></content:encoded>
			<wfw:commentRss>http://beabo.net/2009/02/wordpress%e3%81%ae%e6%9c%80%e6%96%b0%e3%81%ae%e8%a8%98%e4%ba%8b%e3%81%8b%e3%82%89%e7%94%bb%e5%83%8f%e3%82%92%e4%b8%80%e8%a6%a7%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
