WordPressのエントリーの本文と本文続きの間にGoogle Adsenseの広告を入れたいのですが、テンプレートのどこを修正すればそれが実現可能でしょうか?もしくはそれに適したプラグイン、設定などがありますでしょうか?

ただし、投稿時に自分でエントリー欄にタグを入れるのではなく、一度設定すればタグ挿入を意識しなくてもいい形を希望します。

回答の条件
  • URL必須
  • 1人2回まで
  • 登録:
  • 終了:2009/02/12 23:55:03
※ 有料アンケート・ポイント付き質問機能は2023年2月28日に終了しました。

回答2件)

id:NazeNani No.1

回答回数1615ベストアンサー獲得回数276

ポイント35pt

クラスファイルをいじる手もありますが、お手頃なところだと

AdSense ManagerというWordpress用の無料のプラグインがあります。

Wordpress blog内へのAdSenseの自動挿入などが可能になります。:

http://wordpress.org/extend/plugins/adsense-manager/

id:wackey

ありがとうございます。

このプラグインも試してみたのですが、どうも「本文と本文続きの間に」は出来ないようです。

2009/02/06 06:52:52
id:hijk05 No.2

回答回数1307ベストアンサー獲得回数23

ポイント35pt

テンプレートのindex.php に以下のように入れるとできますよ。

<?php $g_google_ct=0; ?>
	<?php if (have_posts()) : ?>

		<?php while (have_posts()) : the_post(); ?>
		
		<div class="post">
		<?php
			if (is_page()) { 
			 the_content('続きを読む'); 
			} else { ?> 
			<div class="title">
			<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
			<small><b>Posted:</b> <?php the_time('Y/m/d') ?> | <b>Filed under:</b> <?php the_category(', ') ?> <?php the_tags(' | <b>Tags:</b> ', ', ', ''); ?> <?php if ( $user_ID ) : 
			?> | <b>Modify:</b> <?php edit_post_link(); ?> <?php endif; ?></small>
			</div>
			<?php the_content('続きを読む'); ?>

<!-- Google広告 -->
ここにコードを書く
<!-- Google広告 -->

http://q.hatena.ne.jp/answer

id:wackey

ありがとうございます。

index.phpだとトップページのみのようです。

(5記事あるとAdsenseの1ページ3個までのルールにも違反してしまいます。)

個別エントリーでは実現できないのでしょうか?

2009/02/06 08:15:45
  • id:NazeNani
    追加の再回答なのでコメントで失礼します。
    AdSense Managerですが新バージョン3xが出ており、
    これだと下記のPositioning Adsの新機能で文章内に表示させられそうです。

    http://www.mutube.com/mu/getting-started-with-adsense-manager-3x/

    ”Positioning Ads:

    You can include Ads into your Posts and Pages using the code below where “name” is the name of the Ad block you have created. New to v3.x is the addition of the shorthand <!--am#name--> format.

    [ad#name]

    You can also display the default Ad in your posts and pages by omitting #name. Doing this allows you to switch these Ads simply by switching the Default Ad in Manager » Ads.

    [ad]

    Of course any Ads in posts update automatically when colours or layouts are modified.
    Code

    You can include Ads in your non-Widget blog adding the code below in your Wordpress templates. For example, a good place to add Ads might be sidebar.php.

    <?php adsensem_ad('name'); ?>

    Again you can display the Default ad by omitting the ‘name’ e.g.

    <?php adsensem_ad(); ?>

    If you want to avoid errors when you disable AdSense Manager you’ll want to add a function check to the above code. For example:

    <?php if(function_exists('adsensem_ad')){ adsensem_ad("name"); } ?>
    More

    If you have any further questions on using Adsense Manager or have suggestions for modifications, simply leave a comment & I’ll get back to you.”

    ついでに何かあれば、開発者の方が要望も受け入れて下さる様なので、メールしてみてはいかがでしょうか。

この質問への反応(ブックマークコメント)

「あの人に答えてほしい」「この質問はあの人が答えられそう」というときに、回答リクエストを送ってみてましょう。

これ以上回答リクエストを送信することはできません。制限について

回答リクエストを送信したユーザーはいません