<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									ページに出現する最初の H2 見出し手前だけは広告を表示しない。 - 要望				            </title>
            <link>https://wp-cocoon.com/community/demands/%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%87%ba%e7%8f%be%e3%81%99%e3%82%8b%e6%9c%80%e5%88%9d%e3%81%ae-h2-%e8%a6%8b%e5%87%ba%e3%81%97%e6%89%8b%e5%89%8d%e3%81%a0%e3%81%91%e3%81%af%e5%ba%83%e5%91%8a/</link>
            <description>Cocoon ディスカッション掲示板</description>
            <language>ja</language>
            <lastBuildDate>Mon, 20 Apr 2026 15:06:10 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: ページに出現する最初の H2 見出し手前だけは広告を表示しない。</title>
                        <link>https://wp-cocoon.com/community/demands/%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%87%ba%e7%8f%be%e3%81%99%e3%82%8b%e6%9c%80%e5%88%9d%e3%81%ae-h2-%e8%a6%8b%e5%87%ba%e3%81%97%e6%89%8b%e5%89%8d%e3%81%a0%e3%81%91%e3%81%af%e5%ba%83%e5%91%8a/#post-1551</link>
                        <pubDate>Tue, 10 Apr 2018 23:33:07 +0000</pubDate>
                        <description><![CDATA[了解しました！！いつもながら素早いご回答、ありがとうございます！！]]></description>
                        <content:encoded><![CDATA[<p>了解しました！！<br />いつもながら素早いご回答、ありがとうございます！！</p>]]></content:encoded>
						                            <category domain="https://wp-cocoon.com/community/demands/">要望</category>                        <dc:creator>anton</dc:creator>
                        <guid isPermaLink="true">https://wp-cocoon.com/community/demands/%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%87%ba%e7%8f%be%e3%81%99%e3%82%8b%e6%9c%80%e5%88%9d%e3%81%ae-h2-%e8%a6%8b%e5%87%ba%e3%81%97%e6%89%8b%e5%89%8d%e3%81%a0%e3%81%91%e3%81%af%e5%ba%83%e5%91%8a/#post-1551</guid>
                    </item>
				                    <item>
                        <title>RE: ページに出現する最初の H2 見出し手前だけは広告を表示しない。</title>
                        <link>https://wp-cocoon.com/community/demands/%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%87%ba%e7%8f%be%e3%81%99%e3%82%8b%e6%9c%80%e5%88%9d%e3%81%ae-h2-%e8%a6%8b%e5%87%ba%e3%81%97%e6%89%8b%e5%89%8d%e3%81%a0%e3%81%91%e3%81%af%e5%ba%83%e5%91%8a/#post-1535</link>
                        <pubDate>Tue, 10 Apr 2018 13:01:00 +0000</pubDate>
                        <description><![CDATA[ちょっと難しいと思います。子テーマのfunctions.phpに以下の関数を貼り付けて、内部動作をそのように書き換えればできるかと思います。function add_ads_before_1st_h2($the_content) {
  // if ( is_amp() ) {
  //   return $the_content;
  // }
  if ( is_s...]]></description>
                        <content:encoded><![CDATA[<p>ちょっと難しいと思います。</p><p>子テーマのfunctions.phpに以下の関数を貼り付けて、内部動作をそのように書き換えればできるかと思います。</p><pre>function add_ads_before_1st_h2($the_content) {
  // if ( is_amp() ) {
  //   return $the_content;
  // }
  if ( is_singular() &amp;&amp; //投稿日・固定ページのとき
       is_ad_pos_content_middle_visible() &amp;&amp;//設定で表示が許可されているとき
       is_all_adsenses_visible() //AdSense設定項目で表示が許可されているか
  ){
    //広告（AdSense）タグを記入
    ob_start();//バッファリング
    get_template_part_with_ad_format(get_ad_pos_content_middle_format(), 'ad-content-middle', is_ad_pos_content_middle_label_visible());
    $ad_template = ob_get_clean();
    $h2result = get_h2_included_in_body( $the_content );//本文にH2タグが含まれていれば取得
    //H2見出しが本文中にある場合のみ
    if ( $h2result ) {
      //本文全てのH2見出し手前に広告を表示するか
      if (is_ad_pos_all_content_middle_visible()) {
        //無制限に置換する
        $limit = -1;
      } else {
        //最初のH2の手前に広告を挿入（最初のH2を置換）
        $limit = 1;
      }


      $the_content = preg_replace(H2_REG, $ad_template.PHP_EOL.PHP_EOL.$h2result, $the_content, $limit);
    }
  }
  return $the_content;
} </pre><p>ただ、PHP処理がある程度分かっていないと厳しいかもしれません。</p>]]></content:encoded>
						                            <category domain="https://wp-cocoon.com/community/demands/">要望</category>                        <dc:creator>わいひら</dc:creator>
                        <guid isPermaLink="true">https://wp-cocoon.com/community/demands/%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%87%ba%e7%8f%be%e3%81%99%e3%82%8b%e6%9c%80%e5%88%9d%e3%81%ae-h2-%e8%a6%8b%e5%87%ba%e3%81%97%e6%89%8b%e5%89%8d%e3%81%a0%e3%81%91%e3%81%af%e5%ba%83%e5%91%8a/#post-1535</guid>
                    </item>
				                    <item>
                        <title>ページに出現する最初の H2 見出し手前だけは広告を表示しない。</title>
                        <link>https://wp-cocoon.com/community/demands/%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%87%ba%e7%8f%be%e3%81%99%e3%82%8b%e6%9c%80%e5%88%9d%e3%81%ae-h2-%e8%a6%8b%e5%87%ba%e3%81%97%e6%89%8b%e5%89%8d%e3%81%a0%e3%81%91%e3%81%af%e5%ba%83%e5%91%8a/#post-1519</link>
                        <pubDate>Tue, 10 Apr 2018 08:28:58 +0000</pubDate>
                        <description><![CDATA[「Cocoon 設定」→「広告」で「全てのH2見出し手前に広告を挿入」を選択しています。全く私的な事情で申し訳ないのですが、「ページに出現する最初の H2 見出し手前だけは広告を表示しない。」と言う設定は難しいでしょうか？以前作ったサイトを再構築と言う事もあり、ページタイトルの下にすぐ H2 が現れてしまう作り方をしてしまったんです。ほとんどが、こういう構造のため、いきなり広告...]]></description>
                        <content:encoded><![CDATA[<p><br />「Cocoon 設定」→「広告」で「全てのH2見出し手前に広告を挿入」を選択しています。</p><p>全く私的な事情で申し訳ないのですが、「ページに出現する最初の H2 見出し手前だけは広告を表示しない。」と言う設定は難しいでしょうか？</p><p>以前作ったサイトを再構築と言う事もあり、ページタイトルの下にすぐ H2 が現れてしまう作り方をしてしまったんです。</p><p>ほとんどが、こういう構造のため、いきなり広告が現れてしまうんです。<br />「これはちょっと…どうなんだろ。」と言う感じになってしまっているんです。</p><p>もしできれば、と思い要望提案させていただきました。</p><p>このディレクトリ以下が対象のページ群です。<br />http://antonsan.net/vt/excel-db</p><p>例えばこちらのページです。<br />http://antonsan.net/vt/excel-db/page-091</p><p><br />お手数をおかけいたしますが、ご検討のほどよろしくお願いします。</p>]]></content:encoded>
						                            <category domain="https://wp-cocoon.com/community/demands/">要望</category>                        <dc:creator>anton</dc:creator>
                        <guid isPermaLink="true">https://wp-cocoon.com/community/demands/%e3%83%9a%e3%83%bc%e3%82%b8%e3%81%ab%e5%87%ba%e7%8f%be%e3%81%99%e3%82%8b%e6%9c%80%e5%88%9d%e3%81%ae-h2-%e8%a6%8b%e5%87%ba%e3%81%97%e6%89%8b%e5%89%8d%e3%81%a0%e3%81%91%e3%81%af%e5%ba%83%e5%91%8a/#post-1519</guid>
                    </item>
							        </channel>
        </rss>
		