サポート » 使い方全般 » 記事一覧でのアドセンス広告が次のページで表示されない

  • 解決済 RMVP

    (@rmvp)


    いつもお世話になっております。
    現在、トップページでは固定ページではなく、記事一覧を表示しています。

    そこで、3つ目と6つ目の記事下にアドセンス広告を設置したのですが、記事一覧のページ2へ進むとアドセンスは表示されません。

    ページ2、3、4と進んでも、3つ目と6つ目にアドセンスを取り込むにはどのように記述するとできますか?

    現在は、下記の記述をしております。

    <?php /* Template for displaying posts page and category archives */
    if (have_posts()) :
    	$counter = 1;
    	$max_posts = $wp_query->post_count;
    	while (have_posts()) : the_post(); $loop_count++;
    		if ($counter == 1) :
    			get_template_part('content', 'lead'); ?>
    			<hr class="mh-separator"><?php
    		else :
    			get_template_part('content');
    		endif;
    		$counter++; ?>
    <?php if ( $loop_count == 3 || $loop_count == 6 ) : ?>
    
    /* アドセンスコード */
    
    <?php endif; ?>
    	<?php endwhile;
    else :
    	get_template_part('content', 'none');
    endif;
    mh_newsdesk_lite_pagination(); ?>

    テーマは下記のテーマを使い、content-news.phpへの記述をしております。

    https://ja.wordpress.org/themes/mh-newsdesk-lite/

    皆さまのアドバイス・ご指導いただけましたら幸いでございます。
    何卒宜しくお願い申し上げます。

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • モデレーター jim912

    (@jim912)

    if (is_home() && $paged < 2 || is_category() && $paged < 2) {
    	get_template_part('content', 'news');
    } else {
    	if (have_posts()) :
    		while (have_posts()) : the_post();
    			get_template_part('content');
    		endwhile;
    		mh_newsdesk_lite_pagination();
    	else :
    		get_template_part('content', 'none');
    	endif;
    } ?>

    該当テーマの index.php (の一部)は、上記のようになっており、2ページ目以降は、content-news.php ではなく content.php が読み込まれるようになっているようです。

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック「記事一覧でのアドセンス広告が次のページで表示されない」には新たに返信することはできません。