新安裝Wordpress以后
一、給根目錄文件 wp-config.php 加以下代碼
- define('WP_POST_REVISIONS', false);//主要作用是讓ID連續(xù)
復(fù)制代碼
二、進(jìn)后臺先啟用兩個插件 wp-pagenavi 分頁鏈接 super-switch 主要作用是讓ID連續(xù)
三、wp-includes/functions.php 加入以下代碼,計(jì)算發(fā)帖量的(我覺得不是很準(zhǔn)確,誰優(yōu)化好了,請記得發(fā)給我一份,謝謝。)
- //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
復(fù)制代碼
四、wp-includes/general-template.php 加入以下代碼,內(nèi)頁標(biāo)題輸出帶一部分正文.
- //內(nèi)頁標(biāo)題輸出帶一部分正文
- //$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')."...";
復(fù)制代碼
附件下載http:///demo/wordpress-for-microblog.rar 演示見http:///blog/ 轉(zhuǎn)載請注明出處:http:///wordpress-for-microblog-twitter.html
|