新安装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:///demo/wordpress-for-microblog.rar 演示见http:///blog/ 转载请注明出处:http:///wordpress-for-microblog-twitter.html
|