很多朋友喜欢在自己的wordpress中添加Google广告,特别是侧边栏、文章页,牵一发而动全身,而用插件的话,听说很影响速度,为此,俺就在此说一说如何修改文件来实现添加Google广告.
.侧边栏广告:0 K1 q1 c) V7 C: T/ x
侧边栏广告是通过修改改模板的rsidebar.php文件实现的,打开这个文件,找到代码:
- <?php wp_list_categories(‘show_count=1title_li=<h2>日志分类</h2>’); ?>
- <li><h2>广告也精彩</h2>
- ===这里是你的广告代码===
- </li>
( @# p; K7 Z; l" I6 k1 A
2.在文章内添加google广告:
先在你当前使用的博客主题文件夹中找到single.php文件,用记事本打开文件,找到这段代码- Y l+ O" _* j
:
- <?phpthe_content
- <divstyle=”float:right;padding-bottom:10px;padding-top:10px;”>
- ===这里是你的广告代码====
- </div>
- <?phpcomments_template();?>
- <divstyle=”float:right;padding-bottom:10px;padding-top:10px;”>
- ===这里是你的广告代码====
- </div>
