<?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>条件分岐 | 株式会社ウェブマジック</title>
	<atom:link href="https://www.webmagic.co.jp/tag/conditional_tags/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.webmagic.co.jp</link>
	<description>島根県松江市ウェブデザイン・ホームページ制作会社</description>
	<lastBuildDate>Sat, 04 Mar 2023 03:26:45 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>

<image>
	<url>https://www.webmagic.co.jp/wp-content/uploads/2025/02/favicon-150x150.png</url>
	<title>条件分岐 | 株式会社ウェブマジック</title>
	<link>https://www.webmagic.co.jp</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>トップページに固定</title>
		<link>https://www.webmagic.co.jp/2568/</link>
		
		<dc:creator><![CDATA[ウェブマジック]]></dc:creator>
		<pubDate>Sat, 04 Mar 2023 03:26:45 +0000</pubDate>
				<category><![CDATA[Weblog]]></category>
		<category><![CDATA[備忘録]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[条件分岐]]></category>
		<guid isPermaLink="false">https://www.webmagic.co.jp/?p=2568</guid>

					<description><![CDATA[<p>$sticky = get_option( 'sticky_posts' ); $args_sticky = get_posts(array( 'post_type' =&#62; 'post', 'post__in' = [&#8230;]</p>
<p>The post <a href="https://www.webmagic.co.jp/2568/">トップページに固定</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><code>$sticky = get_option( 'sticky_posts' );<br />
$args_sticky = get_posts(</code><code>array( 'post_type' =&gt; 'post', 'post__in' =&gt; $sticky, ) ); </code></p>
<p><code>'category__not_in' =&gt; array(),</code></p><p>The post <a href="https://www.webmagic.co.jp/2568/">トップページに固定</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>親ページ[固定ページ]に子一覧を表示</title>
		<link>https://www.webmagic.co.jp/1364/</link>
		
		<dc:creator><![CDATA[ウェブマジック]]></dc:creator>
		<pubDate>Sat, 30 Nov 2013 06:02:52 +0000</pubDate>
				<category><![CDATA[Weblog]]></category>
		<category><![CDATA[備忘録]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[条件分岐]]></category>
		<guid isPermaLink="false">https://www.webmagic.co.jp/?p=1364</guid>

					<description><![CDATA[<p>固定ページの親ページに子の内容を表示 &#60;?php $child_posts = get_posts(&#039;numberposts=-1&#38;order=ASC&#38;orderby=menu_order [&#8230;]</p>
<p>The post <a href="https://www.webmagic.co.jp/1364/">親ページ[固定ページ]に子一覧を表示</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>固定ページの親ページに子の内容を表示</p>
<pre class="brush: php; gutter: true">&lt;?php
$child_posts = get_posts(&#039;numberposts=-1&amp;order=ASC&amp;orderby=menu_order&amp;post_type=page&amp;post_parent=&#039;.親ID );

$child_posts = get_posts(&#039;numberposts=-1&amp;order=ASC&amp;orderby=menu_order&amp;meta_key=キー&amp;meta_value=値&amp;post_type=page&amp;post_parent=&#039;.親ID );

if ( $child_posts ):
  foreach ( $child_posts as $child ) :
    $c_title = apply_filters( &#039;the_title&#039;, $child-&gt;post_title );
    $c_content = get_extended( $child-&gt;post_content );
    $c_content = apply_filters( &#039;the_content&#039;, $c_content[&#039;main&#039;] );
    $c_url = $child-&gt;guid;
    //$thumb = get_the_post_thumbnail( $child-&gt;ID, array(300,300) );
?&gt;
&lt;div class=&quot;inner&quot;&gt;
  &lt;p class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;&lt;?php echo $c_url; ?&gt;&quot;&gt;&lt;?php if($thumb) { echo $thumb; } else { echo &#039;no image&#039;; } ?&gt;&lt;/a&gt;&lt;/p&gt;
  &lt;div class=&quot;ex&quot;&gt;
  &lt;h2&gt;&lt;a href=&quot;&lt;?php echo $c_url; ?&gt;&quot;&gt;&lt;?php echo $c_title; ?&gt;&lt;/a&gt;&lt;/h2&gt;
  &lt;?php // ↓抜粋を表示の時はコメントタグを削除
         // 文字数の指定$count = 100;
         //$excerpt = mb_substr($c_content, 0, $count);
         //if( mb_strlen($c_content) &gt; $count ){ echo $excerpt, &#039;[...]&lt;/p&gt;&#039;; } else { echo $c_content; }
  ?&gt;
  &lt;/div&gt;
&lt;/div&gt;&lt;!--inner--&gt;
&lt;?php
endforeach;
endif;
wp_reset_postdata();
?&gt;</pre>
<p>&nbsp;</p><p>The post <a href="https://www.webmagic.co.jp/1364/">親ページ[固定ページ]に子一覧を表示</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>サイドバー[固定ページ（親子）リスト]</title>
		<link>https://www.webmagic.co.jp/1362/</link>
		
		<dc:creator><![CDATA[ウェブマジック]]></dc:creator>
		<pubDate>Sat, 30 Nov 2013 05:51:55 +0000</pubDate>
				<category><![CDATA[Weblog]]></category>
		<category><![CDATA[備忘録]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[条件分岐]]></category>
		<guid isPermaLink="false">https://www.webmagic.co.jp/?p=1362</guid>

					<description><![CDATA[<p>固定ページが親子関係にある時、サイドバーにリスト表示 if(is_page()){ $ancestor = array_pop( get_post_ancestors( $post-&#62;ID ) ); $parent [&#8230;]</p>
<p>The post <a href="https://www.webmagic.co.jp/1362/">サイドバー[固定ページ（親子）リスト]</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>固定ページが親子関係にある時、サイドバーにリスト表示</p>
<pre class="brush: php; gutter: true">if(is_page()){
$ancestor = array_pop( get_post_ancestors( $post-&gt;ID ) );
$parent = get_page($ancestor);
$root_ID = esc_attr($parent-&gt;ID);
$root_title = esc_attr($parent-&gt;post_title);
  $children = wp_list_pages(&quot;title_li=&amp;child_of=&quot;.$root_ID.&quot;&amp;echo=0&quot;);
  if($children) {
    echo &#039;&lt;div class=&quot;sab_nav&quot;&gt;&#039;;
    echo &#039;&lt;p&gt;&#039;.$root_title.&#039;&lt;/p&gt;&#039;;
    echo &#039;&lt;ul class=&quot;sab_nav&quot;&gt;&#039;;
    echo $children;
    echo &#039;&lt;/ul&gt;&#039;;
    echo &#039;&lt;/div&gt;&#039;;
  }
}</pre>
<p>&nbsp;</p><p>The post <a href="https://www.webmagic.co.jp/1362/">サイドバー[固定ページ（親子）リスト]</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>固定ページ親情報</title>
		<link>https://www.webmagic.co.jp/1357/</link>
		
		<dc:creator><![CDATA[ウェブマジック]]></dc:creator>
		<pubDate>Sat, 30 Nov 2013 05:41:37 +0000</pubDate>
				<category><![CDATA[Weblog]]></category>
		<category><![CDATA[備忘録]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[条件分岐]]></category>
		<guid isPermaLink="false">https://www.webmagic.co.jp/?p=1357</guid>

					<description><![CDATA[<p>固定ページで親子関係にある時、ID・スラッグを利用 $ancestor = array_pop( get_post_ancestors( $post-&#62;ID ) ); $parent = get_page($anc [&#8230;]</p>
<p>The post <a href="https://www.webmagic.co.jp/1357/">固定ページ親情報</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>固定ページで親子関係にある時、ID・スラッグを利用</p>
<pre class="brush: php; gutter: true">$ancestor = array_pop( get_post_ancestors( $post-&gt;ID ) );
$parent = get_page($ancestor);
$parent_ID = esc_attr($parent-&gt;ID);
$root_slug = esc_attr($parent-&gt;post_name);
$root_title = esc_attr($parent-&gt;post_title);</pre><p>The post <a href="https://www.webmagic.co.jp/1357/">固定ページ親情報</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress条件分岐：スマホ &#8211; PC</title>
		<link>https://www.webmagic.co.jp/720/</link>
		
		<dc:creator><![CDATA[ウェブマジック]]></dc:creator>
		<pubDate>Sat, 01 Dec 2012 05:36:45 +0000</pubDate>
				<category><![CDATA[Weblog]]></category>
		<category><![CDATA[備忘録]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[条件分岐]]></category>
		<guid isPermaLink="false">https://www.webmagic.co.jp/?p=720</guid>

					<description><![CDATA[<p>&#60;?php if( function_exists(&#039;wp_is_mobile&#039;) &#38;&#38; wp_is_mobile() ) : ?&#62; スマホ表示 &#60;?php else [&#8230;]</p>
<p>The post <a href="https://www.webmagic.co.jp/720/">WordPress条件分岐：スマホ – PC</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; gutter: true; first-line: 1">&lt;?php if( function_exists(&#039;wp_is_mobile&#039;) &amp;&amp; wp_is_mobile() ) : ?&gt;
スマホ表示
&lt;?php else: ?&gt;
PC表示
&lt;?php endif; ?&gt;</pre><p>The post <a href="https://www.webmagic.co.jp/720/">WordPress条件分岐：スマホ – PC</a> first appeared on <a href="https://www.webmagic.co.jp">株式会社ウェブマジック</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
