In the past few days, my VPS always feels like the sidebar is empty, especially when I pull it to the bottom, the sidebar is always a little shorter, which doesn’t look good. I happened to have applied for a google advertising account before, so hurry up. It’s only over $10 after a year. Although I don’t expect to receive a Western Union money order, it’s still good to fill in the blanks.
Since my blog uses the prower theme, if I use gadgets, I have to redo the sidebar, which is very troublesome, so I don’t want to do it anymore. I searched a lot of information on the Internet, but not many people talk about sidebar placementGoogle Advertising, I will write down my method below, and the one using plug-ins has passed. I also know that using plug-ins is convenient, but it is said that too many plug-ins affect the speed, and I am even more afraid of the three-egg space. Terrified.
My style of sidebar advertising is achieved by modifying the rsidebar.php file. Open this file and find the code:
<?php wp_list_categories('show_count=1&title_li=<h2>Log categories</h2> '); ?>
Add in front:
<li><h2>Sponsored Advertisement</h2>
  <script type=”text/javascript”><!–
google_ad_client = “pub-4927989493131784″;
/* 234×60, created on 10-4-24 */
google_ad_slot = “8099243278″;
google_ad_width = 234;
google_ad_height = 60 ;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
 </li>
Then go to the front desk and see if there is a "Sponsored Ad" in the sidebar. Do you see "Webpage not found" below? "Don't worry, because Google Ads still needs some time to get to know this new home, and it will usually be ready within a few minutes.
Let’s talk about how to add Google ads in the article. First, find the single.php file in the blog theme folder you are currently using, open the file with Notepad, and find this code:
<?phpthe_content
Insert the following code before this code:
  
  <divstyle=”float:right;padding-bottom:10px;padding-top:10px; ”>
<script type=”text/javascript”><!–
google_ad_client = “pub-4927989493131784″;
/* 250×250, created on 10-4-24 */
google_ad_slot = “6483146422″;
google_ad_width = 250;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript”
src =”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>  
  </div>
<x3 > 
 Similarly, if you want to add ads at the bottom of the article, you can continue to find this code:
<?phpcomments_template();?>
Place the following code in front of this code:
  
  <divstyle=”float:right;padding-bottom:10px;padding-top:10px; ”>
<script type=”text/javascript”><!–
google_ad_client = “pub-4927989493131784″;
/* 234×60, created on 10-4-24 */
google_ad_slot = “8099243278″;
google_ad_width = 234;
google_ad_height = 60;
//–>
</script>
<script type=”text/javascript”
src =”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>  
  </div>
Passed this way The advantage of changing the way the file adds code to add ads is that you can avoid using plug-ins, but if you change the theme, you will have to change it again. But for the speed, I think the trouble is worth it. Well, it's very simple, go try it now.


Hong Kong/United States/Domestic High Speed ​​VPS

postid
19957

Leave a Reply