存档

文章标签 ‘Wordpress’

为什么我喜欢用Posterous来写博客?

2009年9月6日 康爷 9 条评论

今天 @posterous RT了一篇文章:How Posterous is Changing Blogging。注意,它用的是blogging,而不是blog,意思就是,Posterous改变的是写博客的方式,而不是博客本身。恩,下面我也说说自己为什么喜欢用Posterous来更新博客。

1.We all like GMail

这个很重要,我想了想,能在GMail里更新博客确实是一件很不错的事情。以前一直用Windows Live Writer来写博客,也觉得这个软件不错。但是,有个致命的问题,Windows Live Writer并不是我一直需要使用的软件,而且打开速度不快,所以你要为了写博客而写博客,去打开这么一个微软的软件,自然减少了写博客的简单程度。

GMail则不然,相信GMail的用户应该上网都会开的吧,作为Chrome浏览器的用户,我又为GMail创建了快捷应用,使得GMail几乎可以全屏显示。GMail可以说是一个很好的工作平台,于是通过GMail给posterous发一封EMail,写一篇博客,就变得很轻松了。

另一个方面,GMail支持插入图片了。有了这个功能,我在给Posterous发送邮件时,插入图片就相当方便了,可以自己选择图片的位置,也不用输入((nogallery))了。加上GMail现在一次可以选择多个文件作为附件,更加方便了。

最后,GMail支持自动保存,而且是WEB应用,云的概念。

2.发布照片很简单

Posterous已经成为一个发布照片的重要服务了,原因很简单,只要将图片作为附件,给post@posterous.com发去一封邮件,就可以啥事不用管,Posterous自动将你的照片发布到你的博客中去了。为什么不用Twitpic呢?很简单,Twitpic不是博客,单张的照片不能说明很多问题,有时候一连串的照片,讲的是一个故事。并且,默认情况下,Posterous会将图片做成gallery,便于查看。

3.你可以发布任何东西?!

事实上,Posterous还是一个文件托管地,你可以发布图片,mp3,pdf等等,只要将文件放入附件中去即可。这个太让人兴奋了。

4.完美集成了各项WEB 2.0服务

Posterous的Autopost功能真是太让人喜欢了,发不完博客后,实时地就能同步发到各种WEB 2.0服务中去,甚至还能同步到你的wordpress博客,这为你省去了很多配置啊,插件啊的事情。第一时间的发布到social media,使得你的博客会更快地被人看到,更快地被RT和评论。Posterous支持使用Twitter账户登录评论,也是很好的。

并且,发布的话是可以自定义的。同时,Posterous的tag也很方便,只要在邮件的title处,加上((tags:a,b,c,d))即可。

最近,Posterous还支持了Google Analytics和Feedburner,让人觉得有不错,特别是严重依赖Google服务的我们。

5.免费的绑定域名

这个很关键!

使用posterous发布,来源: Western Bridge over Google Wave

Wordpress 2.6发布-新功能介绍

2008年7月15日 康爷 2 条评论

image 今天Wordpress开发博客上发表了一篇文章:WordPress 2.6,意味着Wordpress 2.6正式发布了~

下面我们来看看Wordpress 2.6给我们带来了什么新的功能:

1.可以插入高清视频

只要使用下面的一段代码,你就可以在Wordpress 2.6中插入高清晰度的视频了(前不久Google推出了youtube视频的高清晰版本)。

<embed src=”http://v.wordpress.com/mARhRBcT/fmt_dvd” type=”application/x-shockwave-flash” width=”640″ height=”385″ flashvars=”blog_domain=http://wordpress.org/development/2008/07/wordpress-26/&width=640&height=385″> </embed>

阅读全文…

分类: 翻译 标签:

Wordpress插件Simple Tags的技术文档

2008年7月10日 康爷 2 条评论

函数调用篇:

Related Posts : st_related_posts()

With this functionnality, you can show related posts on your post. Is related posts which have at least one common tag.
If you don’t wish to show related posts, but use them inside the loop, use st_get_related_posts() function.

Usage:
  1. <?php st_related_posts(); ?>

Default Usage:
  1. ‘number’ => 5,

  2. ‘order’ => ‘count-desc’,

  3. ‘format’ => ‘list’,

  4. ‘include_page’ => ‘true’,

  5. ‘exclude_posts’ => ”,

  6. ‘exclude_tags’ => ”,

  7. ‘post_id’ => ”,

  8. ‘except_wrap’ => ‘55′,

  9. ‘limit_days’ => ‘0′,

  10. ‘title’ => __(‘<h4>Related posts</h4>’, ’simpletags’),

  11. ‘nopoststext’ => __(‘No related posts.’, ’simpletags’),

  12. ‘dateformat’ => $this->dateformat,

  13. ‘xformat’ => __(‘<a href="%post_permalink%" title="%post_title% (%post_date%)">%post_title%</a> (%post_comment%)’, ’simpletags’)

Example:

We want to show the first 10 related post without title, without pages and without comments count.

  1. <?php st_related_posts(‘number=10&title=&include_page=false&xformat=<a href="%permalink%" title="%title% (%date%)">%title%</a>’); ?>

Parameters:
  • number
    (integer) Number of posts to show
  • order
    (string) Order posts sorting. Valid values are :
    • count-desc – (default) by number of common tags (most relevance)
    • count-asc – by number of common tags (less relevance)
    • date-desc – by publication’s date descending
    • date-asc – by publication’s date ascending
    • name-asc – by title ascending
    • name-desc – by title descending
    • random – random
  • format
    (string) show tags as non ordered list UL/LI
    • flat – (Default) posts are separated with spaces
    • list – posts are inside non ordered lists containing class=’related_posts’
    • array -posts are inside a PHP array (use it with st_get_related_posts())
  • include_page
    (boolean) "true" to add pages, "false" only for posts
  • exclude_posts
    (string) Separate posts ID to exclude with commas
  • exclude_tags
    (string) Separate tags ID to exclude with commas
  • post_id
    (integer) Specified post ID for display related posts
  • except_wrap
    (integer) Words number for excerpt.
  • limit_days
    (string) Limit result with a max days
  • title
    (string) Specify the positioned title before the list
  • nopoststext
    (string) Specify the text to show when there is no related post
  • dateformat
    (string) Specify the date format. Same format as
    PHP date function
  • xformat
    (string) Extended links format. Available Markups :
    • %post_date% – Replaced by the date of the post
    • %post_permalink% – Replaced by the permalink of the link
    • %post_title% – Replaced by the title of the post
    • %post_comment% – Replaced by the comments count of the post
    • %post_tagcount% – Replaced by the number of common tags
    • %post_id% – Replaced by the ID of the post
    • %post_relatedtags% – Replaced by common tag list
    • %post_excerpt% – Replaced by post excerpt
Tags cloud: st_tag_cloud()

With this functionnality you can show a color tags cloud created dynamically.
If you don’t want to show it, but use it, use st_get_tag_cloud() function.

Usage:
  1. <?php st_tag_cloud(); ?>

Default Usage:
  1. ’size’ => ‘true’,

  2. ’smallest’ => 8,

  3. ‘largest’ => 22,

  4. ‘unit’ => ‘pt’,

  5. ‘color’ => ‘true’,

  6. ‘maxcolor’ => ‘#000000′,

  7. ‘mincolor’ => ‘#CCCCCC’,

  8. ‘number’ => 45,

  9. ‘format’ => ‘flat’,

  10. ‘cloud_selection’ => ‘count-desc’,

  11. ‘cloud_sort’ => ‘random’,

  12. ‘exclude’ => ”,

  13. ‘include’ => ”,

  14. ‘limit_days’ => 0,

  15. ‘min_usage’ => 0,

  16. ‘notagstext’ => __(‘No tags.’, ’simpletags’),

  17. ‘xformat’ => __(‘<a href="%tag_link%" class="tag-link-%tag_id%" title="%tag_count% topics" %tag_rel% style="%tag_size% %tag_color%">%tag_name%</a>’, ’simpletags’),

  18. ‘title’ => __(‘<h4>Tag Cloud</h4>’, ’simpletags’),

  19. ‘category’ => 0

Example:

We wish to display randomly the top 100 tags, the max width will be 45px, the min 12px. The color used for max tags will be red (#FF0000) and for min tags green (#00FF0B). At last, the title will be "Tags Cloud"

  1. <?php st_tag_cloud(‘cloud_selection=count-desc&cloud_sort=random&number=100&title=Mon nuage de tags&largest=45&smallest=12&unit=px&maxcolor=#FF0000&mincolor=#00FF0B’); ?>

Parameters:
  • size
    (boolean) Active or not dynamic font size generation
  • smallest
    (integer) Length of the font to use to show the less used tags
  • largest
    (integer) Length of the font to use to show the most used tags
  • unit
    (string) Measuring unit of the used font for smallest and largest parameters. Use pt for point
  • color
    (boolean) Active or not dynamic color generation. true/false
  • maxcolor
    (string) Used color for most popular tags
  • mincolor
    (string) Used color for less popular tags
  • number
    (integer) Number of tags to show inside the tags cloud (Use ‘0′ to show all of them)
  • format
    (string) Tag’s format of posting
    • flat – (Default) Tags are separated by spaces
    • list – tags are inside a non ordered list (UL) containing class=’st-tag-cloud’
    • array – tags are inside a PHP array (use it with st_get_tag_cloud())
  • cloud_selection
    (string) Tags selection order. Valid values are :
    • count-desc – (default) by number of usage tags (most popular)
    • count-asc – by number of usage tags (least used)
    • name-asc – by tag name ascending
    • name-desc – by tag name descending
    • random – random
  • cloud_sort
    (string) Tags selection order. Valid values are :
    • count-desc – by number of usage tags (most popular)
    • count-asc – by number of usage tags (least used)
    • name-asc – by tag name ascending
    • name-desc – by tag name descending
    • random – (default) random
  • exclude
    (string) list of tags to exclude, separated by commas (term_id). For example ‘exclude=5,27′ means all tags which contain term_id 5 or 27 will be NOT shown. By default, any tag is excluded.
  • include
    (string) list of tags to include, separated by commas (term_id). For example ‘exclude=5,27′ means all tags which contain term_id 5 or 27 will be the alone tags to be shown. By default, all tags are included
  • limit_days
    (integer) Number of days to be considered to generated tag cloud.
  • min_usage
    (integer) Min number of tag counter for display it into tag cloud
  • notagstext
    (string) Text to show, if there is no tag.
  • xformat
    (string) Extended format of links. You can personalize the formating of tag’s link. Available markups :
    • %tag_link% – Replaced by the permalink of the tag
    • %tag_feed% – Replaced by the RSS tag link
    • %tag_id% – Replaced by the tag ID
    • %tag_count% – Replaced by the use number (counter) of the tag
    • %tag_size% – Replaced by the size of the tag (creates : font-size:17pt;)
    • %tag_color% – Replaced by the color of the tag (creates : color:#666666;)
    • %tag_name% – Replaced by the tag’s name
    • %tag_name_attribute% – Replaced by the tag’s name, formatted for attribute HTML
    • %tag_rel% – Replaced by rel tag markup (creates : rel="tag")
    • %tag_scale% – Replaced by tag scale (between 1 and 10)
    • %tag_technorati% – Replaced by Technorati tag link
    • %tag_flickr% – Replaced by Flickr tag link
    • %tag_delicious% – Replaced by Del.ici.ous tag link
  • title
    (string) Specify the positioned title shown before tags cloud
  • category
    (string) Restrict tag cloud to a specifik category. (or more, separated with comma)
Current posts tags: st_the_tags()

This feature extend WordPress builtin function "the_tags()", you can specify tag format, text if no tags and post id, also outside the loop
If you don’t want to show it, but use it, use st_get_the_tags() function.

Usage:
  1. <?php st_the_tags(); ?>

Default Usage:
  1. ‘before’ => __(‘Tags: ‘, ’simpletags’),

  2. ’separator’ => ‘, ‘,

  3. ‘after’ => ‘

  4. ‘,

  5. ‘post_id’ => ”,

  6. ‘xformat’ => __(‘<a href="%tag_link%" title="%tag_name%" %tag_rel%>%tag_name%</a>’, ’simpletags’),

  7. ‘notagtext’ => __(‘No tag for this post.’, ’simpletags’),

  8. ‘number’ => 0

Parameters:
  • before
    (string) Text to display before the actual tags are displayed. Defaults to Tags:
  • separator
    (string) Text or character to display between each tag link. The default is a comma (,) between each tag.
  • after
    (string) Text to display after the last tag. The default is to display nothing.
  • post_id
    (integer) Specified post ID for display tag posts (outside loop by example)
  • xformat
    string) Extended format of links. You can personalize the formating of tag’s link. Available markups :
    • %tag_link% – Replaced by the permalink of the tag
    • %tag_feed% – Replaced by the RSS tag link
    • %tag_id% – Replaced by the tag ID
    • %tag_name% – Replaced by the tag’s name
    • %tag_name_attribute% – Replaced by the tag’s name, formatted for attribute HTML
    • %tag_rel% – Replaced by rel tag markup (creates : rel="tag")
    • %tag_technorati% – Replaced by Technorati tag link
    • %tag_flickr% – Replaced by Flickr tag link
    • %tag_delicious% – Replaced by Del.ici.ous tag link
  • notagtext
    (string) Text to show, if there is no tag.
  • number
    (integer) Limit tags output with this max number
Related tags: st_related_tags()

This feature display a list of related tags into tag view. It allow to restrict tag search with an another tag.
This function output a list only on tag view, else it display nothing.

If you don’t wish to show related tags, but use them inside the loop, use st_get_related_tags() function.

Usage:
  1. <?php st_related_tags(); ?>

Default Usage:
  1. ‘number’ => 5,

  2. ‘order’ => ‘count-desc’,

  3. ’separator’ => ‘ ‘,

  4. ‘format’ => ‘list’,

  5. ‘method’ => ‘OR’,

  6. ‘title’ => __(‘<h4>Related tags</h4>’, ’simpletags’),

  7. ‘notagstext’ => __(‘No related tag found.’, ’simpletags’),

  8. ‘xformat’ => __(‘<span>%tag_count%</span> <a href="%tag_link_add%">+</a> <a href="%tag_link%">%tag_name%</a>’, ’simpletags’)

Parameters:
  • number
    (integer) Number of posts to show
  • order
    (string) Order posts sorting. Valid values are :
    • count-desc – (default) by tag counter (most popular)
    • count-asc – by tag counter (less used)
    • name-asc – by tag name ascending
    • name-desc – by tag name descending
    • random – random
  • format
    (string) output format
    • flat – (Default) tags are separated with spaces
    • list – tags are inside non ordered lists containing class=’related_posts’
    • array – tags are inside a PHP array (use it with st_get_related_posts())
  • method
    (string) Method of tags intersections and unions used to build related tags link:
    • OR – Fetches posts with either the "Tag1" or the "Tag2" tag.
    • AND – Fetches posts with both the "Tag1" and the "Tag2" tag.
  • title
    (string) Specify the positioned title before the list
  • notagstext
    (string) Specify the text to show when there is no related tags
  • xformat
    (string) Extended links format. Available Markups :
    • %tag_link_add% – Replace by the link, build from the actual URL + Tag to add
    • %tag_link% – Repla
      ced by the permalink of the tag
    • %tag_feed% – Replaced by the RSS tag link
    • %tag_id% – Replaced by the tag ID
    • %tag_count% – Replaced by the use number (counter) of the tag
    • %tag_name% – Replaced by the tag’s name
    • %tag_name_attribute% – Replaced by the tag’s name, formatted for attribute HTML
    • %tag_rel% – Replaced by rel tag markup (creates : rel="tag")
    • %tag_technorati% – Replaced by Technorati tag link
    • %tag_flickr% – Replaced by Flickr tag link
    • %tag_delicious% – Replaced by Del.ici.ous tag link
    Remove related tags: st_remove_related_tags()

    This feature display a list of remove related tags into tag view. It allow to remove one tag from URL.
    This function output a list only on tag view, else it display nothing.

    If you don’t wish to show remove related tags, but use them inside the loop, use st_get_remove_related_tags() function.

    Usage:
    1. <?php st_remove_related_tags(); ?>

    Default Usage:
    1. ’separator’ => ‘ ‘,

    2. ‘format’ => ‘list’,

    3. ‘notagstext’ => ‘ ‘,

    4. ‘xformat’ => __(‘&raquo; <a href="%tag_link_remove%" title="Remove %tag_name_attribute% from search">Remove %tag_name%</a>’, ’simpletags’)

    Parameters:
    • format
      (string) output format
      • flat – (Default) tags are separated with spaces
      • list – tags are inside non ordered lists containing class=’related_posts’
      • array – tags are inside a PHP array (use it with st_get_related_posts())
    • notagstext
      (string) Specify the text to show when there is no related tags
    • xformat
      (string) Extended links format. Available Markups :
      • %tag_link_remove% – Replaced by the link with current tags except tags to remove
      • %tag_link% – Replaced by the permalink of the tag
      • %tag_feed% – Replaced by the RSS tag link
      • %tag_id% – Replaced by the tag ID
      • %tag_count% – Replaced by the use number (counter) of the tag
      • %tag_name% – Replaced by the tag’s name
      • %tag_name_attribute% – Replaced by the tag’s name, formatted for attribute HTML
      • %tag_rel% – Replaced by rel tag markup (creates : rel="tag")
      • %tag_technorati% – Replaced by Technorati tag link
      • %tag_flickr% – Replaced by Flickr tag link
      • %tag_delicious% – Replaced by Del.ici.ous tag link
分类: 他山之石 标签:

中文 WordPress 工具箱使用指南

2008年7月10日 康爷 没有评论

用来解决官方 WordPress 没有照顾到的中文相关问题。使用这个插件,你可以显示随机文章,最新留言,留言最多文章,发表评论最多的网友,以及真正的文章摘要(如果你的模板里使用的是the_excerpt()来调用内容的话)等等,真正截断,没有乱码。

这个插件由 WordPress 随机文章和 WordPress 评论插件合并增强而来。在激活这个插件之前,请务必先停用这两个插件,不然的话会有冲突。

下载:mulberrykit.zip

安装:

解压缩,把 mulberrykit.php 上传至 /wp-content/plugins/
在管理界面里激活 中文 WordPress 工具箱插件(如果你在使用 WordPress 随机文章WordPress 评论插件,务必先停用这两个插件。)

使用说明:

1、最新回响

<?php get_recent_comments(); ?>

调用方式:get_recent_comments($no_comments = 5, $before = ‘<li> ‘, $after = ‘</li>’, $show_pass_post = false)

$no_comments:显示回响数,缺省为5条;
$before:每条记录前显示的文字,缺省<li>
$after:每条记录后显示的文字,缺省</li>
$show_pass_post:是(true)/否(false)显示保护了的文章,缺省否(false)

补充:
kdolphin 在回应里提出,希望在最新回响里不显示自己的回应。这很容易做到。在get_recentcomments() 这个函数里找到这一句

post_status = ‘publish’

在后面 加上

AND comment_author != ‘桑葚’

就可以了。(把上面的桑葚改成你自己的昵称;引号是半角的)

注意:最好在wp的插件编辑窗口下改,以免乱码的问题。

根据网友的建议加上了两个相关的函数:
仅显示留言,不包括引用 <?php get_recent_comments_only (); ?>
仅显示引用(包括trackback和pingback)<?php get_recent_trackbacks(); ?>

调用方式与<?php get_recent_comments(); ?>相同。

2、最新文章

根据网友们的反馈,我把这个最新文章的函数又放回来了。

<?php get_recent_posts(); ?>

调用方式:get_recent_posts($no_posts = 5, $before = ‘<li>+ ‘, $after = ‘</li>’, $show_pass_post = false, $skip_posts = 0)

$no_posts:显示文章数,缺省为5条;
$before:每条记录前显示的文字,缺省<li>
$after:每条记录后显示的文字,缺省</li>
$show_pass_post:是(true)/否(false)显示保护了的文章,缺省否(false)
$skip_posts:跳过多少篇文章,缺省为0;

3、评论最多的帖子

<?php get_mostcommented(); ?>

调用方式:get_mostcommented($limit = 5)

4、发表评论最多的网友

<?php get_commentmembersstats(); ?>
把代码里面的blogmaster改成你自己的名字,可以滤掉你自己的名字。

调用方式:get_commentmembersstats($threshhold = 5)

5、随机文章

由这个插件修改而来:

a、改了提取excerpt摘要的方式,可适用于中文;
b、摘要可显示于文章链接的title里,或者直接在页面上,可选;
c、在文章链接的title里显示日期。

在模板里调用 <?php random_posts(); ?>

调用方式: random_posts ($limit = 5, $length = 400, $before = ‘<li>’, $after = ‘</li>’, $show_pass_post = false, $show_excerpt_in_title = true)

$limit:显示文章数,缺省5篇;
$length:摘要长度,缺省400;
$before:每条记录前显示的文字,缺省<li>
$after:每条记录后显示的文字,缺省</li>
$show_pass_post:是(true)/否(false)显示保护了的文章,缺省否(false)
$show_excerpt_in_title:是(true),摘要显示于文章链接的title;否(false),直接显示于页面;缺省是(true)

6、显示摘要

某些情况下需要输出摘要,比如搜索结果、档案,还有 rss 输出,这样可以节省流量资源。但是,如果你的文章是中文的话,官方 WordPress 输出的其实并不是摘要,它只是把文章里的 html 代码过滤掉了,但所有文字都还是原样输出了。

激活这个插件后,输出的就是真正截断的摘要了。

分类: 他山之石 标签: