目前Simple Tags插件(1.6.6版本)暂时不兼容于 Wordpress 2.9,
在论坛上发了一条公告,提醒大家谨慎升级。结果,意外的换来一个解决方案。
表面上说不支持,其实wordpress2.8.6和wordpress2.9的构架变化不是太大,可以强开:
修改 wp-content/plugins/simple-tags/simple-tags.php
if ( strpos($wp_version, '2.7') !== false || strpos($wp_version, '2.8') !== false )
变更为
if ( strpos($wp_version, '2.7') !== false || strpos($wp_version, '2.9') !== false )
绕开版本的检测即可,测试正常,可以放心使用。
nofollow标签的算法变更和百度对该标签的不认可,导致wordpress评论区域最好也据此来做相应的调整。使用robots.txt对自身地址进行屏蔽,从而规避非法链接对自身权重的影响。
其实之前已经做过了相应的改动,只是WP版本一升级,得,把我的改动覆盖了……
做个备忘,并重新操作一遍:
1.打开wp-includes文件夹下的comment-template.php文件
2.找到$return = “<a href=’$url’ rel=’external nofollow’ class=’url’>$author</a>”;语句
3.链接修改为 a href=’/go.php?$url’
4.替换上传
同理,可以修改wp-includes文件夹下的formatting.php文件,修改评论中写到的链接结构。
return $matches[1] . “<a href=\”$url\” rel=\”nofollow\”>$url</a>”;
go.php写法:
- <?php
- header("location: ".$_SERVER['REDIRECT_QUERY_STRING']);
- ?>
wordpress默认会把一些比较大的图片进行裁切压缩处理,自动生成缩略图。
但是我这里并不需要该功能,为此在后台找了一下解决的办法:
登陆wp后台,在”设置==>媒体”中,将图像大小全部改为0

先说今天遇到的一个问题,
我在wordpress模板目录下新建了一个PHP文件,service.php,想要调用<?php get_footer(); ?>函数,得到反馈结果
Fatal error: Call to undefined function get_footer() in D:\web\blog\wp-content\themes\bettersun\service.php on line 73
查了一下解决办法是在该页面头部引入:
require_once('site/wp-config.php');
另外,翻到一些常用的wordpress模板结构及页面函数调用参数,以备后需:

阅读全文 »
@reply回复功能,没必要再添加一个插件来做。我们可以通过修改当前所调用的wordpress主题来实现该功能。
方法如下:
一、在评论页comments.php添加如下JS代码:
- <script language="javascript">
- //<![CDATA[
- function to_reply(commentID,author) {
- var nNd='@'+author+':';
- var myField;
- if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
- myField = document.getElementById('comment');
- } else {
- return false;
- }
- if (document.selection) {
- myField.focus();
- sel = document.selection.createRange();
- sel.text = nNd;
- myField.focus();
- }
- else if (myField.selectionStart || myField.selectionStart == '0') {
- var startPos = myField.selectionStart;
- var endPos = myField.selectionEnd;
- var cursorPos = endPos;
- myField.value = myField.value.substring(0, startPos)
- + nNd
- + myField.value.substring(endPos, myField.value.length);
- cursorPos += nNd.length;
- myField.focus();
- myField.selectionStart = cursorPos;
- myField.selectionEnd = cursorPos;
- }
- else {
- myField.value += nNd;
- myField.focus();
- }
- }
- //]]>
- </script>
二、在functions.php中加入如下代码
- function to_reply() {
- ?>
- <a onclick='to_reply("<?php comment_ID() ?>", "<?php comment_author();?>")' href="#respond" style="cursor:pointer;"/>[@reply]</a>
- <?php
- }
三、在评论页<?php comment_author_link() ?>后边添加”回复按钮”