Archive for the ‘伍德普莱斯’ Category

更改 WordPress 中上传图片的缩略图大小

WordPress 中添加/编辑文章时,可以使用 WordPress 自带的 Uploader 上传文件或者图片。而如果服务器支持的话,WordPress 将会自动将太大的图片另外生成一个名字为 [FileName].thumbnail.[extension] 的缩略图放在上传目录下,这样我们可以在 Blog 中使用缩略图并链接到原始图从而避免图片太大影响浏览。但是 WordPress 默认的缩略图大小太小了,并且后台没有提供这样的选项来更改这个值,这是因为缩略图的长度和宽度是硬编码在 WordPress 的源代码中的。

要想更改缩略图的长宽值,首先需要修改 wp-admin/inline-uploading.php 这个文件,找到下面一段代码:

if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
$thumb = wp_create_thumbnail($file, 128);
elseif ( $imagedata['height'] > 96 )
$thumb = wp_create_thumbnail($file, 96);

将其中的宽度值 128 和长度值 96 改成你喜欢的值,最好保持 4:3 的比例。

另外还需要修改 wp-admin/inline-uploading.phpadmin-functions.php,找到此处:

function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) {
if ( $height <= $hmax && $width <= $wmax )
return array($width, $height);
elseif ( $width / $height > $wmax / $hmax )
return array($wmax, (int) ($height / $width * $wmax));
else
return array((int) ($width / $height * $hmax), $hmax);
}

function get_udims($width, $height) {
if ( $height <= 96 && $width <= 128 )
return array($width, $height);
elseif ( $width / $height > 4 / 3 )
return array(128, (int) ($height / $width * 128));
else
return array((int) ($width / $height * 96), 96);
}

同样改掉其中的数值就可以了。不知道 WordPress 后续的版本会不会考虑提供这样的选项供用户修改呢。

WordPress 官方论坛上的讨论贴:http://wordpress.org/support/topic/53640

WordPress MultiUser Version Released

mu-header-logo.png

WordPress has released its MultiUser version, the download page is http://mu.wordpress.org/download/. Now besides Movable Type, we can select WordPress to setup our multi-user blog system. And the most important is, WordPress is free!

Actually I haven’t install and take a look yet.

Words from WordPress development team:

WordPress MU is an official branch of WordPress that is designed for managing and hosting thousands of blogs instead of just one. It’s the software that powers WordPress.com, for example. MU has been in heavy development for about a year now, and we’ve finally polished it up to a place where we feel like it’s ready for public consumption. Since setup is a bit more complex than the 5-minute install of regular WordPress, MU is best suited for a more server-savvy audience.

Another product is bbPress, a forum can be integrated with WordPress, which means user can login in WordPress and bbPress with the same account. Interesting? Go to download!

[WP-Plugin] Coolcode

以前要在日志中增加代码一直使用QuickCode,但是发现它不够稳定,显示出来的style也不够好。今天找到了CoolCode,还能显示行号,功能更强大。

简易使用方法:

<coolcode lang=”程序设计语言” linenum=”off”>
代码
</coolcode>

[WP Plugin] Polyglot

Polyglot 这个插件可以提供每篇日志或者Page的不同语言的版本,这样访客可以选择他们熟悉的语言来阅读。这样你的站点可以显得更全球化。

该插件的主页是:

http://fredfred.net/skriker/index.php/polyglot

用法很简单:

</lang_xx> Your XX(English, Chinese or etc) language here... </lang_xx>

但是,当你想重新编辑一个“多语言”日志项时,你需要重新插入”lang_xx”代码到文字中去,显然这样会比较麻烦。你最好一次编辑好所有的问题。

不知道这是否根当前WP的版本有关。(更新:这应该是WP的所见所得编辑器的问题)

不过在我看来这个插件还是很cool的。

Polyglot, a WordPress plugin to make you offer different language versions for each entry and visitors are able to select their prefer language to read.

Of course, it makes your site more international, more global.

This plugin site is here:

http://fredfred.net/skriker/index.php/polyglot

Its usage is simple like that:

</lang_xx> Your XX(English, Chinese or etc) language here... </lang_xx>

However, I’ve found one disadvantage(or bug?) of this plugin: if you want to edit your “multi-languaged” entry you have saved it before, you have to re-insert the “lang_xx” code to your words again, that may be bother somebody.

I don’t know yet wether this issue is ralted to the WP’s version I used. (Update: It should be because of the bug of WSYSG editor)

Anyway, it’s a so cool plugin!

[WP Plugin] WordPress Related Entries

这个插件可以在每个Entry后面显示出与其相关的其他Entries。对于想查看同一类别的主题的人来说,还是很方便的。

插件主页地址:
http://www.w-a-s-a-b-i.com/archives/2006/02/02/wordpress-related-entries-20/

PS:下载后的插件解压缩后是带目录的,然而要正确安装此插件,需要直接将目录中的文件直接拷贝到 /wp-content/plugins 下,不能带目录拷贝,否则第一次建立索引的时候会不成功的。

[UPDATED 2007-01-25] 上面的网址已经无法访问了,因此提供本地下载:

[Download not found]

[WP Plugin] Hide or Cut Post Text

通过这个插件,你可以隐藏你不想公开的话,让blog也有了私密空间。

插件的下载地址和安装手册见:
http://www.coffee2code.com/archives/2004/07/25/plugin-hide-or-cut-post-text/

不过看起来,这个插件对WP2实效了。所以我们可以使用以下的方法:
http://eiart.net/blog/archive/42 

Compare cell phone plans and deals | Thanks to New WordPress Themes, WordPress Themes Directory and Classified Ads