一月 14
记得是2006年8月27日第一次接触的K2,很是为K2的功能强大和可定制性惊艳,就一直用了下来。可是一直以来,很是为K2的这两点小缺憾不满意:为K2不支持中文wordpress工具箱、因而不能显示最新留言;还有k2默认的是不显示文章分类的。
总是盼着K2的升级可以解决这些问题,很快的2006年8月28日,k2升级到了0.9.1版本,虽然还不满足我的需求,可是让我看到了升级的曙光,于是就继续等待了下来.........
时光飞逝如贱,转眼就到了2007年了,看来继续等待K2升级的想法是不对的,在仔细地批判了自己的惰性之后,我决定了,还是自己动手吧。
其实很简单,修改了一下K2的sidebar.php,立马就搞定了,唉......,5分钟的事情,拖了要5个月了。
附录:我对K2的sidebar.php的修改
- --- old/sidebar.php 2007-01-14 10:12:37.000000000 +0800
- +++ new/sidebar.php 2007-01-14 10:36:04.000000000 +0800
- @@ -134,8 +134,24 @@
- <?php wp_get_archives('type=postbypost&limit=10'); ?>
- </ul>
- </div>
- - <?php } ?>
- +
- + <?php /*中文wordpress工具箱 Plugin */ if ((function_exists('get_recent_comments'))) {?>
- + <div>
- + <h2><?php _e('最新留言'); ?></h2>
- + <a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e('RSS Feed for all Comments','k2_domain'); ?>" class="feedlink"><img src="<?php bloginfo('template_directory'); ?>/images/feed.png" alt="RSS" /></a>
- + <ul>
- + <?php get_recent_comments(); ?>
- + </ul>
- + </div>
- + <?php } ?>
- + <div>
- + <h2><?php _e('Categories','k2_domain'); ?></h2>
- + <ul>
- + <?php wp_list_cats('sort_column=name&hierarchical=0'); ?>
- + </ul>
- + </div>
- + <?php } ?>
- <?php /* FlickrRSS Plugin */ if ((function_exists('get_flickrRSS')) and is_home() and !(is_paged())) { ?>
- <div>
- @@ -191,12 +207,13 @@
- <?php } ?>
- - <?php /* Related Posts Plugin */ if ((function_exists('related_posts')) and is_single() and ($notfound != '1')) { ?>
- + <?php /* Related Posts Plugin */ if ((function_exists('UTW_ShowRelatedPostsForCurrentPost')) and is_single() and ($notfound != '1')) { ?>
- <div>
- <h2><?php _e('Related Entries','k2_domain'); ?></h2>
- <ul>
- - <?php related_posts(10, 0, '<li>', '</li>', '', '', false, false); ?>
- + <?php UTW_ShowRelatedPostsForCurrentPost("posthtmllist",'','10'); ?>
- +
- </ul>
- </div>
- <?php } ?>
注:以上32行以后的修改是将k2原来的相关主题的调用由Related Posts Plugin改为使用UTW的相关主题函数,感觉会比Related Posts Plugin的结果更加准确些。
一月 14th, 2007 at 11:27 am
[...] 有关于本页面 « 为K2增加最新留言和文章分类显示----懒惰故事系列之六 [...]