Tag: wordpress
How to make ecto work with Ultimate Tag Warrior
by Robin Lu on Dec.29, 2005, under Uncategorized
I once wrote about “How to make ecto work with Jerome’s Keywords“. Unfortunately, Jerome’s Keywords does not work well with Wordpress 2.0. With suggestion from Meng Yan, I switched to Ultimate Tag Warrior. Again, I met the problem of how to make ecto work with it. Here’s the solution.
- make sure Ecto is using Movable Type API to contact with your wordpress. You can check it out in the Account settings.
- set up the template of tags in Ecto. Set the “Tag separator” as “,” which is the default setting and “Put tags in” as “keywords” which is NOT the default setting.

- update the xmlrpc.php in the directory of your blog system. add the following line into the function mw_newPost and mw_editPost after where $content_struct is initialized:
$_POST['tagset'] = $content_struct['mt_keywords'];
Here’s the sample code to show where to make the modification (below the comments “ROBINLU HACK”):
/* metaweblog.newPost creates a post */
function mw_newPost($args) {
global $wpdb, $post_default_category;
... ...
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
// ROBIN LU HACK
$_POST['tagset'] = $content_struct['mt_keywords'];
$comment_status = (empty($content_struct['mt_allow_comments'])) ?
... ...
}
... ...
/* metaweblog.editPost ...edits a post */
function mw_editPost($args) {
global $wpdb, $post_default_category;
$this->escape($args);
$post_ID = $args[0];
... ...
$post_title = $content_struct['title'];
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
$catnames = $content_struct['categories'];
// ROBINLU HACK
$_POST['tagset'] = $content_struct['mt_keywords'];
$post_category = array();
... ...
}
Update: See Part II to get ecto fully functional with UTW.
解决wordpress插件stattraq的乱码问题
by Robin Lu on Dec.28, 2005, under Uncategorized
Stattraq是wordpress的一个统计插件,可以对点击、Page Views、引用以及搜索关键词等等进行统计。这个插件有一个问题,就是在显示一些诸如页面标题或者搜索关键词的时候常常出现乱码。今天检查了一下,发现是调用php函数htmlentities时出的问题,按照文档,缺省编码是ISO-8859-1,而我的是UTF-8,结果就乱码了。
修改的方式是把wp-stattraq目录下summary.php和query_strings.php里的
htmlentities(…)
改成:
htmlentities(…, ENT_COMPAT, “UTF-8″)
How to make ecto work with Jerome’s Keywords
by Robin Lu on Sep.15, 2005, under Uncategorized
The support for tags in Wordpress 1.5.2 still depends on plugins. I use Jerome’s Keywords for this purpose. However, it does not work well with Ecto. I digged into the source code of the plugin and wordpress implementation of xml-rpc a bit. Although I am not familiar with php, I managed to make Ecto work with Jerome’s Keywords plugin. Here’s how to do it:
- make sure Ecto is using Movable Type API to contact with your wordpress. You can check it out in the Account settings.
- set up the template of tags in Ecto. Set the “Tag separator” as “,” which is the default setting and “Put tags in” as “keywords” which is NOT the default setting.
- update the xmlrpc.php in the directory of your blog system. add the following line into the function mw_newPost and mw_editPost after where $content_struct is initialized:
$_REQUEST['keywords_list'] = $content_struct['mt_keywords'];
Have a try with your Ecto. Set tags when you are composing blogs. After publishing, you can find the tags you set in ecto work just fine with Jerome’s Keywords Plugin.
If you have no interesting in how it works, you can stop here. Now I’d like to explain how I made it.
First, Ecto supports submit tag information as keyword with Movable Type API as mt_keywords. What you have to do is just to enable it in Templates settings. Meanwhile, Jerome’s Keywords hooks the action “publish_post” and “edit_post” to add keywords into post meta table. It extracts the keyword from the HTML REQUEST. So, my hack is to fake the request parameter “keywords_list” with the information in mt_keywords. They happend to use the same structure to present the tags so all I have to do is to add a single line in each post related method in xmlrpc.php