企业网站优化 » 技术与编程代码

ID #1126

wordpress投放google广告代码技巧自定义添加按钮

对于使用wordpress升级后编辑器无法使用的问题一个总结,如果你之前是旧版本升级到新版本3.3的话,一定要对新版本的文件进行修改,不然编辑器是不显示的,所以要使用新的文件,程序员可能方便些在本地修改文件再上传服务器的,不能对旧的文件保留而应该同步,下面是营销型网站制作团队为客户制作的:Wordpress添加google Adsense自定义按钮代码的方法:背景从3.2.1升级3.3版本,成功:

 

在主题的functions.php文件里添加下面代码:

 

function do_adsense() {
$adsense = '你的google adsense代码';
return $adsense;
}
add_shortcode('adsense', 'do_adsense');
然后在3.3的版本wp-includes/js/quicktags.dev.js的基础上修改,不要再在3.2.1旧版本修改了,有出错的。
下面是我添加上去的,不添加就要手动直接添加[adsense]在内容上也生效的,只是麻烦些。
quicktags.dev.js代码如下:
 在 edButtons[10] = new qt.TagButton('strong','b','<strong>','</strong>','b'); 这之前添加:
edButtons[5] = new qt.TagButton('adsense','adsense','[adsense]','','adsense');

同理,quicktags.js是上面的quicktags.dev.js的 压缩js后的,压缩后是速度快些,真正运行是这个压缩后的代码的。
edButtons[5]=new c.TagButton("adsense","adsense","[adsense]","","adsense");
然后你在发内容的时候,就会多出一个按钮实现点击就会添加google的广告代码。
Wordpress添加google Adsense自定义按钮代码
Wordpress添加google Adsense自定义按钮代码
成功,wordpress3.3版本。

 

喜欢这篇文章吗?那就点击按扭分享她吧!

Tags: wordpress, wordpress自定义按钮

相关项目: -

更新日期:2011-12-16 05:30
作者:: admin
修订: 1.1

Digg it! Share on Facebook 打印 发送给朋友 输出为PDF文件
Propose a translation for Propose a translation for
请给问答评分:

平均分: 0 (0 Vote)

(完全没有价值) 1 2 3 4 5 (非常有价值)

你可以对此问答发表评论


包月网络电话