插件推荐:Text Control Plugin
前些天要把博客的 twitter 页面的Flash Widget 改为 HTML Widget ,因为Flash调用毕竟有些慢。
可是当我把从Twitter HTML Widget 代码辛辛苦苦Copy到编辑页面,然后更新后却发现,twitter 页面 只剩下孤零零的 [ follow me on twitter ]了。
然后,又试了一下Google Friend Connect 的Widget调用,结果也是无法显示。
搜索了一通,发现了一个叫Text Control Plugin 的插件。Wordpress啦对Text Control Plugin的介绍:
可以使用 Text Control Plugin来处理将Javascript引入文章时产生的问题。通过 Text Control Plugin,用户可以在单篇文章或所有文章的基础上,决定是否关闭WordPress的自动格式化功能,将可执行代码转换为可读代码。把需要引入Javascript的文章设置为No Formatting 或Markup或nl2br或No Character Formatting。用户可能需要试验一下是否设置成功。提醒:使用Text Control Pulgin时,用户需要先保存文章,然后再进行编辑,之后才能看到Text Control Pulgin的选项。
选择No Formatting会导致文章内容集中在一起,这样就不得不在其中添加段落标签以及其他HTML标签,以达到平时WordPress系统自动生成的格式效果。
只要将此插件上传到服务器上并激活,然后把Twitter HTML Widget的代码Copy到源代码页面就可以了。这时twitter的HTML页面应该好用了。预览我的twitter页面。
至于Google Friend Connect代码的调用,可能需要将复制的代码进行一下整理。拿Members gadgets为例,需要将类似
<div id="div-2819831980225908339" style="width:276px;border:1px solid #cccccc;"></div>
的代码改为:
<div id="div-2819831980225908339"></div>
就是把style属性去掉。还有要把
skin['BORDER_COLOR'] = ‘#cccccc’;
skin['ENDCAP_BG_COLOR'] = ‘#e0ecff’;
skin['ENDCAP_TEXT_COLOR'] = ‘#333333′;
skin['ENDCAP_LINK_COLOR'] = ‘#0000cc’;
skin['ALTERNATE_BG_COLOR'] = ‘#ffffff’;
skin['CONTENT_BG_COLOR'] = ‘#ffffff’;
skin['CONTENT_LINK_COLOR'] = ‘#0000cc’;
skin['CONTENT_TEXT_COLOR'] = ‘#333333′;
skin['CONTENT_SECONDARY_LINK_COLOR'] = ‘#7777cc’;
skin['CONTENT_SECONDARY_TEXT_COLOR'] = ‘#666666′;
skin['CONTENT_HEADLINE_COLOR'] = ‘#333333′;
skin['NUMBER_ROWS'] = ‘4′;
和<!– –>等注释代码也去掉,这时Google Friend Connect在文章页面才能好用。整理之后的代码是大概这样的:
<script type="text/javascript">
var skin = {};
google.friendconnect.container.setParentUrl(‘/’ /* location of rpc_relay.html and canvas.html */);
google.friendconnect.container.renderMembersGadget(
{ id: ‘div-3360599298945528106′,
site: ‘16515116168188564710′ },
skin);
</script>
别问我为啥要这么改,因为我也不知道。

因为更换模板导致链接都丢失了,重新链接一下吧~
[Reply]
leplay Reply:
June 12th, 2009 at 2:19 pm
好的。感觉丸子最近懒了很多呀,哈哈。
[Reply]