- 追加された行はこの色です。
- 削除された行はこの色です。
[[WordPressめも]]へ戻る
WordPressにAdSenseを掲載するには [[AdSense Manager:http://wordpress.org/extend/plugins/adsense-manager/]] というプラグインを導入すると良さそうです。
やってみたけど、なぜか表示されず・・・。結局AdSenseから取得したソースを直接貼り付けました。
スマートフォンページにAdSenseを掲載する場合はこちら [[スマートフォンからの閲覧に対応する]]
*作業メモ [#ud8e2cbd]
テーマをうっかり更新してしまったりした時のための個人的に広告を掲載している場所のメモです。なので以下は見ないで下さい。
テーマをうっかり更新してしまったりした時のための個人的に広告を掲載している場所のメモです。なので見ないで下さい。
#contents
**Twenty Ten index.php [#m0a8bb04]
*Twenty Ten [#le2b8f2a]
**ヘッダ広告 ブログTOP [#g237a982]
wp-content/themes/twentyten/ 以下共通で記述
-index.php ブログTOP
-archive.php アーカイブ記事
-category.php カテゴリー記事
-search.php 検索結果
<div id="content" role="main">
<!-- 468x60 -->
**ヘッダ、フッタ広告 単一記事ページ [#a7e6e8d4]
wp-content/themes/twentyten/loop-single.php
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- 468x60 -->
<!-- 略 -->
</div><!-- #content -->
</div><!-- #nav-below -->
<br />
<table border="0" style="border-style: none;">
<tr>
<td width="320" align="center">
<!-- 300x250-->
</td>
<td width="320" align="center">
<!-- 300x250 -->
</td>
</tr>
</table>
**フッタ広告 複数記事ページ [#w637e7b8]
1ページに複数記事を表示する場合は、一番上にある記事のすぐ下に300x250の広告が2つ表示されるように mv_count で記事数を判定する。~
AdSenseのバナー広告数は1ページ3つまでなので、ヘッダ1つ、フッタ2つの合計3つに対応するための処置。
wp-content/themes/twentyten/loop.php
<?php while ( have_posts() ) : the_post(); ?>
<?php $_REQUEST['mv_count']++; ?>
<!-- 略 -->
</div><!-- #post-## -->
<?php if ($_REQUEST['mv_count'] == 1) { ?>
<table border="0">
<tr>
<td width="320" align="center">
<!-- 300x250 -->
</td>
<td width="320" align="center">
<!-- 300x250 -->
</td>
</tr>
</table>
<br /><br />
<?php } ?>
<?php comments_template( '', true ); ?>
**Twenty Ten loop-single.php [#v7ab4df5]
*Twenty Twelve [#fc0842ae]
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
**ヘッダ広告 [#x86b92bd]
wp-content/themes/twentytwelve/ 以下共通で記述
-index.php ブログTOP
-single.php 記事詳細
-archive.php アーカイブ記事
-category.php カテゴリー記事
-search.php 検索結果
<div id="content" role="main">
<div style="margin-bottom: 10px;">
<!-- 468x60 -->
</div>
**フッタ広告 [#l1df4e6d]
1ページに複数記事を表示する場合は、一番上にある記事のすぐ下に300x250の広告が2つ表示されるように mv_count で記事数を判定する。~
AdSenseのバナー広告数は1ページ3つまでなので、ヘッダ1つ、フッタ2つの合計3つに対応するための処置。
wp-content/themes/twentytwelve/content.php
<?php
$_REQUEST['mv_count']++;
?>
<!-- 略 -->
</div><!-- #nav-below -->
</div><!-- .entry-content -->
<br />
<?php if ($_REQUEST['mv_count'] == 1) { ?>
<table border="0">
<tr>
<td width="320" align="center">
<!-- 300x250 -->
</td>
<td width="320" align="center">
<!-- 300x250 -->
</td>
</tr>
</table>
<?php } ?>
<?php endif; ?>
**固定ページ [#od730637]
wp-content/themes/twentytwelve/page.php
<div id="content" role="main">
<div style="margin-bottom: 10px;">
<!-- 468x60 -->
</div>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<table border="0">
<tr>
<td width="320" align="center">
<!-- 300x250 -->
</td>
<td width="320" align="center">
<!-- 300x250 -->
</td>
</tr>
</table>
#exlink