|
 
- 积分
- 171
- 金钱
- 137 WPB
|
[原创文章] 用wordpress打造微型博客twitter
本帖最后由 jookr 于 2009-2-25 07:40 编辑
新安装Wordpress以后
一、给根目录文件
wp-config.php
加以下代码-
- define('WP_POST_REVISIONS', false);//主要作用是让ID连续
复制代码 二、进后台先启用两个插件
wp-pagenavi 分页链接
super-switch 主要作用是让ID连续
三、wp-includes/functions.php
加入以下代码,计算发帖量的(我觉得不是很准确,谁优化好了,请记得发给我一份,谢谢。)- //count 1 day post count1day()
- function count1day()
- {
- global $wpdb;
- $strsql = "SELECT count( ID ) AS c FROM wp_posts WHERE post_date > SUBDATE(NOW(),INTERVAL 1 day)" ;
- $xxooxx = $wpdb->get_var($strsql);
- return $xxooxx;
- }
- //count 1 day post count1day()
- //count 1 week post count1week()
- function count1week()
- {
- global $wpdb;
- $strsql = "SELECT count( ID ) AS c FROM wp_posts WHERE post_date > SUBDATE(NOW(),INTERVAL 1 week)" ;
- $xxooxx = $wpdb->get_var($strsql);
- return $xxooxx;
- }
- //count 1 week post count1week()
- //count post
- function countsend()
- {
- global $wpdb;
- $strsql = "SELECT count( ID ) AS c FROM wp_posts" ;
- $xxooxx = $wpdb->get_var($strsql);
- return $xxooxx;
- }
- //count post
复制代码 四、wp-includes/general-template.php
加入以下代码,内页标题输出带一部分正文.-
- //内页标题输出带一部分正文
- //$title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );//原代码 替换成以下
- $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) ).":".strip_tags( apply_filters( 'single_post_content', $post->post_content ) );
- if(strlen($title) > 120)
- $title = mb_substr($title,0,120,'UTF-8')."...";
复制代码 附件下载http://tarr.cn/demo/wordpress-for-microblog.rar
演示见http://tarr.cn/blog/
转载请注明出处:http://tarr.cn/wordpress-for-microblog-twitter.html |
附件: 您需要登录才可以下载或查看附件。没有帐号?注册
-
1
评分人数
-
|