Archive for the 'Blog更新' Category

关于Wp-chache插件找不到advanced-cache.php的错误

星期日, 三月 2nd, 2008

今天“WordPress主题和插件研究”成功搬到了国外新的空间,可是却出现了找不到advanced-cache.php的错误,解决办法很简单,只需在wp-content下面上传一个文件symlink.php并运行和一个空白的php文件advanced-cache.php及可解决,内容如下:

< ? php
symlink("plugins/wp-cache/wp-cache-phase1.php","advanced-cache.php");
?>

补充:直接运行/wp-content/symlink.php即可,不用上传advanced-cache.php,注意wp-content目录的权限为可写。

去年因为比较繁忙,所以本博客断断续续暂停更新了一段时间。新年新希望,希望可以带给大家更多的好看的WordPress主题和实用的WordPress插件。

给博客首页前三篇文章加上Google Adsense广告

星期一, 六月 11th, 2007

用过Google Adsense广告的朋友都知道,博客首页是我们放置广告的最佳位置,而嵌入文章内的广告的转换率最高,如果想在首页的每个标题下面加广告,选择“外观-〉主题编辑器->Main Index Template”,在〈?php if (have_posts()) :?的下面找到〈div class=”entry”〉,然后后面添加你的广告代码就可以了。

〈?php the_title(); ?〉
〈div class=”entry”〉
〈script type=”text/javascript”〉
google_ad_client = “pub-xxxxxxxxxxxxx”;
……

不过问题又来了。 主页上的文章通常都是5-10条,而Google广告要求在每一页显示的广告数量是有限的,通常放置不多于3条468×60的广告,如果按照上面的办法,每个文章标题下面都回出现广告,这是违反Google广告的要求的,小心被封帐号吧。

解决办法很简单,利用一个编程的小技巧,如下:

〈?php while (have_posts()) : the_post(); ?〉上面加上:

〈?php
$xh=1;
?〉
< div class="entry">下面加上

〈?php
if($xh==1 || $xh==2 || $xh==3){
?〉
〈script type=”text/javascript”〉〈!–
google_ad_client = “pub-xxxxxxxx”;
。。。。。你的Google广告代码
。。。。。
//–
〈/script〉
〈script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”〉
〈/script〉
〈?php
}
$xh++;
?〉

这样广告就只会出现在前3篇文站里面了。 注意复制的时候请把< 和>改成英文符号<和>。

终于装好了WP-Cache

星期四, 十二月 7th, 2006

今天终于有空装好了WP-Cache,速度明显快了很多。先把安装步骤及遇到的问题记录如下:

1、下载 WP-Cache,解压上传到wp-content/plugins下面

2、按照提示先做个软连接,链接到wp-conent/advanced-cache.php。

ln -s   wp-content/plugins/wp-cache/wp-cache-phase1.php wp-content/advanced-cache.php

3、登陆后台,激活WP-Cache插件。进入:选项 -〉WP-Cache的管理界面,提示出错。
4、进行配置前确定wp-content目录可以被写,在wp-content目录下创建cache目录,确保cahce目录属于宿主,并且可写。编辑根目录下wp-config.php,  在 require_once(ABSPATH.’wp-settings.php’);  前面加上

define(’WP_CACHE’, true);

require_once(ABSPATH.’wp-settings.php’);

5、配置完成,就可以无错的打开选项 -〉WP-Cache的管理界面,  点击enable it,WP_CACHE就可以正常使用了。

6、 如果遇到如下错误:

Warning: GZIP compression is enabled in Wordpress, wp-cache will be bypassed until you disable gzip compression.
WP-Cache is Disabled

可以在选项 -〉阅读里面关闭GZip。如:

如果浏览者需要,WordPress可以使用压缩格式(gzip)发送文章