用wordpress打造微型博客twitter - WordPress 主題(Theme)...
新安裝Wordpress以后
一、給根目錄文件
wp-config.php
加以下代碼
- define('WP_POST_REVISIONS', false);//主要作用是讓ID連續(xù)
復制代碼二、進后臺先啟用兩個插件
wp-pagenavi 分頁鏈接
super-switch 主要作用是讓ID連續(xù)
三、wp-includes/functions.php
加入以下代碼,計算發(fā)帖量的(我覺得不是很準確,誰優(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
復制代碼四、wp-includes/general-template.php
加入以下代碼,內(nèi)頁標題輸出帶一部分正文.
- //內(nèi)頁標題輸出帶一部分正文
- //$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/轉(zhuǎn)載請注明出處:
http://tarr.cn/wordpress-for-microblog-twitter.html
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請
點擊舉報。