<?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; Flickr</title>
	<atom:link href="http://szdy.info/wp/tag/flickr/feed/" rel="self" type="application/rss+xml" />
	<link>http://szdy.info/wp</link>
	<description></description>
	<lastBuildDate>Tue, 28 Sep 2010 10:42:57 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://szdy.info/wp/tag/flickr/feed/" />
		<item>
		<title>WordPress のサイドバーに記事で使った画像をランダムに表示</title>
		<link>http://szdy.info/wp/2009/05/06/525/</link>
		<comments>http://szdy.info/wp/2009/05/06/525/#comments</comments>
		<pubDate>Wed, 06 May 2009 13:34:56 +0000</pubDate>
		<dc:creator>beta</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://szdy.info/wp/?p=525</guid>
		<description><![CDATA[ちょっと古いプラグインのようですが、サイドバーとか好きな場所に、記事で使った画像をランダムに表示させることができる Random Image Plugin for WordPress を入れてみました。 WordPres [...]]]></description>
			<content:encoded><![CDATA[				<p>ちょっと古いプラグインのようですが、サイドバーとか好きな場所に、記事で使った画像をランダムに表示させることができる <a href="http://justinsomnia.org/2005/09/random-image-plugin-for-wordpress/" title="Random Image Plugin for WordPress - Justinsomnia">Random Image Plugin for WordPress</a> を入れてみました。 WordPress 2.7.1 でも動くようです。</p>
				<p>とてもシンプルに、記事へのリンクを貼った画像を表示するように設定。そして、リンク先の記事名を <code>title</code> 属性で明示すべく randomimage.php の 594 行目をちょこっと修正。</p>
				<dl>
				<dt>書き換え前</dt>
				<dd>
				<pre><code>      $image_html = str_replace(&quot;%2&quot;, &quot;&lt;a href='$post_permalink'&gt;&lt;img src='$image_src' alt='$image_alt' $image_attributes /&gt;&lt;/a&gt;&quot;, $image_html);</code></pre>
</dd>
<dt>書き換え後</dt>
<dd>
<pre><code>      $image_html = str_replace(&quot;%2&quot;, &quot;&lt;a href='$post_permalink'<strong> title='$post_title'</strong>&gt;&lt;img src='$image_src' alt='$image_alt' $image_attributes /&gt;&lt;/a&gt;&quot;, $image_html);
</code></pre>
				</dd>
				</dl>
				<p>あとは、埋め込みたいとこに <code>&lt;?php randomimage(); ?&gt;</code> と書いて、適当にスタイルシートをでっちあげて完成。うちの例だと以下のような感じ。</p>
				<dl>
				<dt>Random Image の設定</dt>
				<dd>
				<p>HTML Template のとこを <code>&lt;li&gt;%2&lt;/li&gt;</code> に。</p>
				<div class="image"><a href="http://szdy.info/wp/wp-content/uploads/2009/05/random_image_settings.jpg"><img src="http://szdy.info/wp/wp-content/uploads/2009/05/random_image_settings-550x378.jpg" alt="random_image_settings" title="random_image_settings" width="550" height="378" class="alignnone size-medium wp-image-581" /></a></div>
				</dd>
				<dt>ランダムイメージを埋め込む &#8211; sidebar.php</dt>
				<dd>
				<pre><code>     &lt;dl class=&quot;navi&quot;&gt;
<!--pre-->&lt;!-- 中略 --&gt;
<!--pre-->        &lt;dt&gt;Random Images&lt;/dt&gt;
<!--pre-->        &lt;dd&gt;
<!--pre-->            &lt;ul class=&quot;randomImages&quot;&gt;
<!--pre--><strong>&lt;?php randomimage(); ?&gt;</strong>
<!--pre-->            &lt;/ul&gt;
<!--pre-->            &lt;br class=&quot;clear&quot; /&gt;
<!--pre-->        &lt;/dd&gt;
<!--pre-->&lt;!-- 中略 --&gt;
<!--pre-->     &lt;/dl&gt;</code></pre>
				</dd>
				<dt>ランダムイメージにあてるスタイルシート</dt>
				<dd>
				<pre><code>/* safari, IEでの余白消し */
<!--pre-->div#utilities dl dd ul.randomImages li a img {
<!--pre-->    line-height: 0;
<!--pre-->    vertical-align: bottom;
<!--pre-->}
<!--pre-->
<!--pre-->/* ランダムイメージ */
<!--pre-->div#utilities dl dd ul.randomImages {
<!--pre-->    float: left;
<!--pre-->    width: 100%;
<!--pre-->    margin: 0;
<!--pre-->    padding: 0;
<!--pre-->    list-style: none;
<!--pre-->    background-color: #eee;
<!--pre-->}
<!--pre-->div#utilities dl dd ul.randomImages li {
<!--pre-->    float: left;
<!--pre-->    width: auto;
<!--pre-->    margin: 0;
<!--pre-->    padding: 0;
<!--pre-->}
<!--pre-->div#utilities dl dd ul.randomImages li a {
<!--pre-->}
<!--pre-->div#utilities dl dd ul.randomImages li img {
<!--pre-->    display: block;
<!--pre-->    width: 75px;
<!--pre-->    height: 75px;
<!--pre-->    border: 2px solid #eee;
<!--pre-->}
<!--pre-->div#utilities dl dd ul.randomImages li a:hover img {
<!--pre-->    border: 2px solid #ff0000;
<!--pre-->}
<!--pre-->div#utilities dl dd br.clear {
<!--pre-->    clear: both;
<!--pre-->}</code></pre>
				</dd>
				</dl>
				<p>という感じでした。</p>
				<dl>
				<dt>参考リソース</dt>
				<dd>
				<ul>
				<li><a href="http://www.meblog.info/93.html" title="記事の画像をサイドバーなどにランダム表示するプラグイン[WP] - ミblog : レビューや日常など">記事の画像をサイドバーなどにランダム表示するプラグイン[WP] &#8211; ミblog : レビューや日常など</a></li>
				</ul>
				</dd>
				</dl>
				<p><ins datetime="2009-05-08T01:52:30+09:00">CSS を加筆修正。</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://szdy.info/wp/2009/05/06/525/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://szdy.info/wp/2009/05/06/525/" />
	</item>
	</channel>
</rss>

