<?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>Wordpress Design b &#187; 便利なテンプレートタグ</title>
	<atom:link href="http://wordpress.b-cures.net/tags/feed/" rel="self" type="application/rss+xml" />
	<link>http://wordpress.b-cures.net</link>
	<description>WordPress、WordPressプラグイン紹介、PHPをやりたい！基礎から覚えたい！そんな自分の覚え書きをつぶやくお勉強の場だったり...</description>
	<lastBuildDate>Thu, 19 Jan 2012 13:00:33 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>WordPressセキュリティ対策xmlrpc.php?rsdを消す</title>
		<link>http://wordpress.b-cures.net/archives/162/</link>
		<comments>http://wordpress.b-cures.net/archives/162/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 02:24:03 +0000</pubDate>
		<dc:creator>b-cures.</dc:creator>
				<category><![CDATA[便利なテンプレートタグ]]></category>

		<guid isPermaLink="false">http://wordpress.b-cures.net/archives/162/</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/162/' addthis:title='WordPressセキュリティ対策xmlrpc.php?rsdを消す '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>WordPressは、デフォルトのままだと、HTMLタグの中にxmlpc?rspというファイルのある場所を記述されています。 これは、Wordpressでサイトを運営する上で、セキュリティ的によろしくないため、この記述を消すことをおすすめします。 header.phpファイルには、そのタグを表示するようなコードはありません。 では、どこで、xml.php?psdファイルの記述を消すかというと、テンプレートの関数が記述されているfunctions.phpなのです。 で、functions.phpの中に remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'rsd_link'); というコードを記述することで、xmlrpc.php?rsdをHTML上から消すことができます。 functions.phpの適切な場所にそのコードを記述しないと、ページ全体が表示されなくなってしまうというトラブルを引き起こしてしまうので、そのあたりを注意してくださいね。 私の場合は、functions.phpのコードを上からたどって、約30行目あたりにある add_action('wp_head', 'kubrick_head'); function kubrick_header_image() { の1行分あいているスペースに、 remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'rsd_link'); を記述して、 add_action('wp_head', 'kubrick_head'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'rsd_link'); function kubrick_header_image() { としました。<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/162/' addthis:title='WordPressセキュリティ対策xmlrpc.php?rsdを消す ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/162/' addthis:title='WordPressセキュリティ対策xmlrpc.php?rsdを消す '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>WordPressは、デフォルトのままだと、HTMLタグの中にxmlpc?rspというファイルのある場所を記述されています。</p>
<p>これは、Wordpressでサイトを運営する上で、セキュリティ的によろしくないため、この記述を消すことをおすすめします。</p>
<p>header.phpファイルには、そのタグを表示するようなコードはありません。</p>
<p>では、どこで、xml.php?psdファイルの記述を消すかというと、テンプレートの関数が記述されているfunctions.phpなのです。</p>
<p>で、functions.phpの中に</p>
<pre name="code" class="c-sharp">
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'rsd_link');</pre>
<p>というコードを記述することで、xmlrpc.php?rsdをHTML上から消すことができます。</p>
<p>functions.phpの適切な場所にそのコードを記述しないと、ページ全体が表示されなくなってしまうというトラブルを引き起こしてしまうので、そのあたりを注意してくださいね。</p>
<p>私の場合は、functions.phpのコードを上からたどって、約30行目あたりにある</p>
<pre name="code" class="c-sharp">
add_action('wp_head', 'kubrick_head');

function kubrick_header_image() {
</pre>
<p>の1行分あいているスペースに、</p>
<pre name="code" class="c-sharp">
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'rsd_link');</pre>
<p>を記述して、</p>
<pre name="code" class="c-sharp">
add_action('wp_head', 'kubrick_head');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'rsd_link');
function kubrick_header_image() {</pre>
<p>としました。</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/162/' addthis:title='WordPressセキュリティ対策xmlrpc.php?rsdを消す ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://wordpress.b-cures.net/archives/162/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>トップページのサイドバーで新着記事を表示するタグ</title>
		<link>http://wordpress.b-cures.net/archives/119/</link>
		<comments>http://wordpress.b-cures.net/archives/119/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 22:07:51 +0000</pubDate>
		<dc:creator>b-cures.</dc:creator>
				<category><![CDATA[便利なテンプレートタグ]]></category>

		<guid isPermaLink="false">http://wordpress.b-cures.net/archives/119/</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/119/' addthis:title='トップページのサイドバーで新着記事を表示するタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>フリー素材新着情報<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/119/' addthis:title='トップページのサイドバーで新着記事を表示するタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/119/' addthis:title='トップページのサイドバーで新着記事を表示するタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><pre name="code" class="php">
<h2>フリー素材新着情報</h2>
<div id="sintyaku">
<?php $posts = get_posts('offset=0&#038;numberposts=5');?>
<?php if($posts):
foreach($posts as $post):
setup_postdata($post);?>
<ul>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php the_time('y/n/j') ?></li>
</ul>

<?php endforeach; endif;?>
</pre>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/119/' addthis:title='トップページのサイドバーで新着記事を表示するタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://wordpress.b-cures.net/archives/119/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>アーカイブなどで子カテゴリのタイトル一覧を表示するタグ</title>
		<link>http://wordpress.b-cures.net/archives/108/</link>
		<comments>http://wordpress.b-cures.net/archives/108/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 21:55:58 +0000</pubDate>
		<dc:creator>b-cures.</dc:creator>
				<category><![CDATA[便利なテンプレートタグ]]></category>

		<guid isPermaLink="false">http://wordpress.b-cures.net/archives/108/</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/108/' addthis:title='アーカイブなどで子カテゴリのタイトル一覧を表示するタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>&#60;ul&#62; &#60;?php foreach((get_the_category()) as $category) {     $cat_id=$category-&#62;cat_ID . ' '; } $myposts = get_posts("numberposts=50&#38;category=".$cat_id."&#38;orderby=post_modified"); foreach($myposts as $post) : ?&#62;     &#60;li&#62;&#60;?php echo date("Y.n.j", strtotime($post-&#62;post_modified)); ?&#62; : &#60;a href="&#60;?php the_permalink() ?&#62;" title="&#60;?php the_title(); ?&#62;"&#62;&#60;?php the_title(); ?&#62;&#60;/a&#62; &#60;/li&#62; &#60;?php endforeach; ?&#62; &#8230; <a href="http://wordpress.b-cures.net/archives/108/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/108/' addthis:title='アーカイブなどで子カテゴリのタイトル一覧を表示するタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/108/' addthis:title='アーカイブなどで子カテゴリのタイトル一覧を表示するタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><pre name="code" class="php">&lt;ul&gt;
&lt;?php
foreach((get_the_category()) as $category) {
    $cat_id=$category-&gt;cat_ID . ' ';
}
$myposts = get_posts("numberposts=50&amp;category=".$cat_id."&amp;orderby=post_modified");
foreach($myposts as $post) : ?&gt;
    &lt;li&gt;&lt;?php echo date("Y.n.j", strtotime($post-&gt;post_modified)); ?&gt; : &lt;a href="&lt;?php the_permalink() ?&gt;" title="&lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;/li&gt;
&lt;?php endforeach; ?&gt;
&lt;/ul&gt;</pre>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/108/' addthis:title='アーカイブなどで子カテゴリのタイトル一覧を表示するタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://wordpress.b-cures.net/archives/108/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ページに特定のファイルをinclude（インクルード）させるタグ</title>
		<link>http://wordpress.b-cures.net/archives/99/</link>
		<comments>http://wordpress.b-cures.net/archives/99/#comments</comments>
		<pubDate>Thu, 07 May 2009 08:00:34 +0000</pubDate>
		<dc:creator>b-cures.</dc:creator>
				<category><![CDATA[便利なテンプレートタグ]]></category>

		<guid isPermaLink="false">http://wordpress.b-cures.net/?p=99</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/99/' addthis:title='ページに特定のファイルをinclude（インクルード）させるタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>1つのpage.phpを使って、テンプレートなどを使わず、特定のテンプレートをインスクードさせたい場合に使用するタグの紹介です。 たとえば、カテゴリのIDが2のページにのみ、menu_home.phpというファイルをincludeインクルードさせたい場合には、 &#60;?php if (is_page('2')){ ?&#62; &#60;?php include (TEMPLATEPATH . '/menu_home.php'); ?&#62; &#60;?php } ?&#62; と記述します。 こうWordPressのpage.phpに記述すると、カテゴリIDが2に属するページにのみmenu_home.phpを表示させることができます。 逆に、カテゴリID2に属さないページの場合には、menu_home.phpは一切表示されません。 WordPressの開始ページを指定している場合には、上記のタグを使って、ホームにだけ新着情報を表示する際などに使用するといいと思います。私もそうしています。 ちなみに、is_pageの記述の部分をin_categoryへと変更をすれば、ページではなく、投稿記事に反映させることも可能です。 &#60;?php if (in_category('2')){ ?&#62; &#60;?php include (TEMPLATEPATH . '/menu_home.php'); ?&#62; &#60;?php } ?&#62;<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/99/' addthis:title='ページに特定のファイルをinclude（インクルード）させるタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/99/' addthis:title='ページに特定のファイルをinclude（インクルード）させるタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>1つのpage.phpを使って、テンプレートなどを使わず、特定のテンプレートをインスクードさせたい場合に使用するタグの紹介です。</p>
<p>たとえば、カテゴリのIDが2のページにのみ、menu_home.phpというファイルをincludeインクルードさせたい場合には、</p>
<pre name="code" class="php">
&lt;?php if (is_page('2')){ ?&gt;
&lt;?php
include (TEMPLATEPATH . '/menu_home.php');
?&gt;
&lt;?php } ?&gt;
</pre>
<p>と記述します。</p>
<p>こうWordPressのpage.phpに記述すると、カテゴリIDが2に属するページにのみmenu_home.phpを表示させることができます。</p>
<p>逆に、カテゴリID2に属さないページの場合には、menu_home.phpは一切表示されません。</p>
<p>WordPressの開始ページを指定している場合には、上記のタグを使って、ホームにだけ新着情報を表示する際などに使用するといいと思います。私もそうしています。</p>
<p>ちなみに、is_pageの記述の部分をin_categoryへと変更をすれば、ページではなく、投稿記事に反映させることも可能です。</p>
<pre name="code" class="php">
&lt;?php if (in_category('2')){ ?&gt;
&lt;?php
include (TEMPLATEPATH . '/menu_home.php');
?&gt;
&lt;?php } ?&gt;
</pre>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/99/' addthis:title='ページに特定のファイルをinclude（インクルード）させるタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://wordpress.b-cures.net/archives/99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>複数のページに特定のファイルをinclude（インクルード）させるタグ</title>
		<link>http://wordpress.b-cures.net/archives/93/</link>
		<comments>http://wordpress.b-cures.net/archives/93/#comments</comments>
		<pubDate>Thu, 07 May 2009 07:36:13 +0000</pubDate>
		<dc:creator>b-cures.</dc:creator>
				<category><![CDATA[便利なテンプレートタグ]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[テンプレートタグ]]></category>
		<category><![CDATA[特定のページ]]></category>

		<guid isPermaLink="false">http://wordpress.b-cures.net/?p=93</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/93/' addthis:title='複数のページに特定のファイルをinclude（インクルード）させるタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>たとえば、WordPressの複数のページ内でpage.phpのテンプレートを切り替えることなく、テンプレートタグや分儀タグだけで別々のメニューなどを表示させたい場合には、 &#60;?php  $post = $wp_query-&#62;post;  if ( is_page('2') ) {  include(TEMPLATEPATH . '/menu_home.php');  } else {  include(TEMPLATEPATH . '/menu.php');  }  ?&#62; と記述します。  if ( is_page('2') ) {  include(TEMPLATEPATH . '/menu_home.php'); は、ホームにだけ表示させたいタグ。 } else {  include(TEMPLATEPATH . '/menu.php'); は、ホーム以外のページにおいて表示させたいタグ。 このタグを使うと、マウスオーバーメニューボタンを装飾したり、今いるページのメニューボタンの個所だけ「今いるページであることがわかりやすいように」デザインを変えるといった凝ったデザインが可能になります。 ホームページ制作ビーキュアズでは、page.phpに上記のようなタグを追加して、サイトマップmenu_sitemap.php、事業内容menu_jigyou.php、事務所概要menu_gaiyou.php、お問い合わせmenu_contact.php、ホームmenu_home.phpのページをマウスオーバーなどで装飾したメニューを表示させ、それ以外の残ったページmenu.phpのページを読み込むようにしています。 &#8230; <a href="http://wordpress.b-cures.net/archives/93/">Continue reading <span class="meta-nav">&#8594;</span></a><div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/93/' addthis:title='複数のページに特定のファイルをinclude（インクルード）させるタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://wordpress.b-cures.net/archives/93/' addthis:title='複数のページに特定のファイルをinclude（インクルード）させるタグ '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>たとえば、WordPressの複数のページ内でpage.phpのテンプレートを切り替えることなく、テンプレートタグや分儀タグだけで別々のメニューなどを表示させたい場合には、</p>
<pre name="code" class="php">
&lt;?php
 $post = $wp_query-&gt;post;
 if ( is_page('2') ) {
 include(TEMPLATEPATH . '/menu_home.php');
 } else {
 include(TEMPLATEPATH . '/menu.php');
 }
 ?&gt;
</pre>
<p>と記述します。</p>
<pre name="code" class="php">
 if ( is_page('2') ) {
 include(TEMPLATEPATH . '/menu_home.php');
</pre>
<p>は、ホームにだけ表示させたいタグ。</p>
<pre name="code" class="php">
} else {
 include(TEMPLATEPATH . '/menu.php');
</pre>
<p>は、ホーム以外のページにおいて表示させたいタグ。</p>
<p>このタグを使うと、マウスオーバーメニューボタンを装飾したり、今いるページのメニューボタンの個所だけ「今いるページであることがわかりやすいように」デザインを変えるといった凝ったデザインが可能になります。</p>
<p>ホームページ制作ビーキュアズでは、page.phpに上記のようなタグを追加して、サイトマップmenu_sitemap.php、事業内容menu_jigyou.php、事務所概要menu_gaiyou.php、お問い合わせmenu_contact.php、ホームmenu_home.phpのページをマウスオーバーなどで装飾したメニューを表示させ、それ以外の残ったページmenu.phpのページを読み込むようにしています。</p>
<p>これは、非常に便利なWordPressのタグです！</p>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style" addthis:url='http://wordpress.b-cures.net/archives/93/' addthis:title='複数のページに特定のファイルをinclude（インクルード）させるタグ ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://wordpress.b-cures.net/archives/93/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

