开发者

Removing google adsense breaks website - Wordpress custom_functions.php

I ad开发者_开发问答ded following code in wordpress custom_function.php file a while ago to display google adsense. Now I want to remove the code but my website breaks when I comment out the following code. I don't understand why. Please provide your input on this.

function sidebar_ads() {
?>
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxx";
/* 160x600, created 9/23/10 for SideBar */
google_ad_slot = "xxxxx";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php }
add_action('thesis_hook_before_sidebars', 'sidebar_ads');


You could simply comment out the line with add_action on it like so

// add_action('thesis_hook_before_sidebars', 'sidebar_ads');

That should stop the function from being called, and you should be ad free :D

Or, to comment out the whole thing:

/*
function sidebar_ads() {
?>
<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxx";
// 160x600, created 9/23/10 for SideBar 
google_ad_slot = "xxxxx";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php  }
add_action('thesis_hook_before_sidebars', 'sidebar_ads'); */

I assume you tried nesting multiline comments. That is not allowed (In every language I know of). Notice I changed the comment on the line with '160x600, created 9/32/10 for SideBar' to use a double slash, so you can wrap the whole thing in /* */

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜