删除谷歌adsense休息网站 - Wordpress custom_functions.php

时间:2010-10-27 01:28:13

标签: php wordpress adsense

我刚才在wordpress custom_function.php文件中添加了以下代码来显示google adsense。现在我想删除代码,但是当我注释掉以下代码时,我的网站会中断。我不明白为什么。请提供您的意见。

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');

1 个答案:

答案 0 :(得分:0)

你可以简单地用add_action注释掉这一行

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

这应该会阻止函数被调用,你应该是免费广告:D

或者,评论整个事情:

/*
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'); */

我假设您尝试嵌套多行注释。这是不允许的(我所知道的每种语言)。 注意我更改了'160x600,为SideBar创建9/32/10'的行上的注释使用双斜杠,所以你可以将整个事情包装在/ * * /