Exemplo n.º 1
0
function is_ads_top_banner_enable()
{
    if (is_ads_visible() && is_ads_performance_visible() && !is_responsive_enable()) {
        if (is_page()) {
            //個別ページのとき
            if (is_mobile()) {
                return true;
            } else {
                return !is_ads_sidebar_top() || is_ads_content_top();
                //サイドバートップ表示以外のとき
            }
        } elseif (is_single()) {
            //投稿ページのとき
            if (is_mobile()) {
                return is_ads_in_content() && !get_h2_included_in_body(get_the_content()) || is_ads_under_relations() || is_ads_sidebar_top() || is_ads_content_top();
                //コンテンツトップ表示のとき
            } else {
                return is_ads_content_top();
                //コンテンツトップ表示のとき
            }
        } else {
            //その他、リスト表示のときなど
            if (is_mobile()) {
                //トップページ以外は必ず表示、トップページは表示がオンになっていたら
                return (!is_home() || is_ads_top_page_visible()) && !is_list_style_bodies();
            } else {
                //サイドバーに広告がなくて、トップページ以外か、TOPページ表示がオンになっているとき
                return !is_ads_sidebar_top() && (!is_home() || is_ads_top_page_visible() || is_ads_content_top()) && !is_list_style_bodies();
            }
        }
    }
}
Exemplo n.º 2
0
function add_widget_before_1st_h2_in_page($the_content)
{
    if (is_page() && is_active_sidebar('widget-in-page-article')) {
        //広告(AdSense)タグを記入
        ob_start();
        //バッファリング
        echo '<div id="widget-in-page-article" class="widgets">';
        dynamic_sidebar('widget-in-page-article');
        //本文中ウィジェットの表示
        echo '</div>';
        $ad_template = ob_get_clean();
        $h2result = get_h2_included_in_body($the_content);
        //本文にH2タグが含まれていれば取得
        if ($h2result) {
            //H2見出しが本文中にある場合のみ
            //最初のH2の手前に広告を挿入(最初のH2を置換)
            $count = 1;
            $the_content = preg_replace(H2_REG, $ad_template . $h2result, $the_content, 1);
        }
    }
    return $the_content;
}