Wordpress 2.0 升級完成

Tuesday, December 27th, 2005 at 7:10 am

由 wordpress 1.5.2 升級至 wordpress 2.0,步驟一樣很簡單。

step 0.
備份檔案、資料庫;關閉所有使用的 plugin;將原本 wordpress 的安裝資料夾清空 or 移至別處。以下檔案可以保留:

  • .htaccess
  • wp-config.php
  • 資料夾 wp-content
  • 資料夾 wp-images
  • 資料夾 wp-includes/languages/
  • step 1.
    上傳 新版 wordpress

    step 2.
    上傳 theme、plugin 等上述原本使用或修改過的檔案。

    step 3.
    瀏覽器連結至 yourdomain.com/wp-admin/upgrade.php,升級完成。

    關於 plugin,目前發現 WP-UserOnline 有資料庫讀取問題 結果是我檔案漏放及修改,已正常使用、Jerome’s keywords 無法新增 tag,打算使用 Ultimate Tag Warrior 代替。 已參考天佑的 Ultimate Tag Warrior 教學,整合舊的 tag 完成。另外,對於 WYSIWYG 的文章發表介面有點不適應,所以我還是用回了原本的編輯器。

    related:

  • What’s New in WordPress 2.0?
  • 2.0 Plugin Compatibility
  • Upgrading WordPress
  • 2005/12/27 updated:
    Comment Quicktags 失效,暫時 disable 掉,等待新版本。

    還沒升級的人,如果沒有對新版本的狂熱的話,也不用急著升,看看官方論壇上目前大量的文章,WP 2.0 可能還存在不少小問題,而且很多 plugin 的支援性還不足,靜待幾日後再升級,其實也是不錯的選擇。

    2005/12/28 updated:

  • 在 WordPress 2.0 使用 AdSense 注意之事
  • Spam Karma 2 在 WordPress 2.0 的修正 (學長好像也有 trackback 發送失敗的問題?)
  • 2005/12/29 updated:
    參照 PipperL 的方法,解決了 trackback 發送失敗的問題。

    Posted in WP 速記
    by hsuyo

    [懶人週間文摘] 20051202

    Saturday, December 3rd, 2005 at 5:47 am

    Games

  • Ace Combat Zero: 新宣傳影片、新桌布下載
  • Final Fantasy XII: 兩張新桌布提供下載
  • Front Mission 5: 新增 Wanzer 桌布下載
  • 聖劍傳說 DS - Children of Mana 發售日確定: 2006.02.23
  • 戰國無雙 2 發售日確定: 2006.02.09
  • [link] 李秉憲擔任 Capcom 於 Xbox 360 上新作的角色,會是鬼武者4 嗎?
  • Wordpress Plugins

  • Google analytics plugin for WordPress
    Semiologic 版本的 Google Analytics Plugin for WP
  • Quick Post
    在 blog 上新增一個快速發表文章的地方,功能類似許多論壇上的快速回應
  • Expire Posts
    使文章在有限時間出現的 plugin
  • Friends RSS Aggregator
    好友聯播功能,可以在單一頁面顯示加入的 RSS feed 文章
  • Alphabetical Plugins
    啟用後,可將 plugin list 依照字母排列
  • del.icio.us Style MP3 Player
    del.icio.us 樣式的線上 MP3 播放器
  • by hsuyo

    WP: Contextual Related Posts

    Tuesday, November 29th, 2005 at 7:05 am

    WP Plugin: Contextual Related Posts,會在每篇文章底部加入可能關聯的文章,亦可指定關聯文章的數量。

    安裝方法: 直接把 PHP 檔放到 plugin 資料夾即可。

    Posted in WP 速記
    by hsuyo

    WordPress 中文臨時論壇

    Wednesday, October 12th, 2005 at 8:57 am

    [link] 幫忙海豚推一下,推推推~

    Posted in WP 速記
    by hsuyo

    [WP] WP-GoogleStats

    Friday, September 23rd, 2005 at 8:55 pm

    眼尖的人應該可以發現首頁或每篇文章底端,都有一個類似 Googlebot visited this page at 9/22, 8:55 pm 的東西,這是使用 WP-GoogleStats 這個 plugin 的效果,可以顯示 Googlebot 訪問 blog 的頻率、次數、以及最後到訪的時間。裝了有一段時間,有人在留言板問了,所以我介紹一下簡易的安裝步驟。

    step 1.
    於資料庫中建立一個新的 table,

    CREATE TABLE `wp_googlestats` (
    `page` varchar(100) NOT NULL DEFAULT '',
    `lastvisit` int(11) NOT NULL DEFAULT '0',
    `frequency` int(11) NOT NULL DEFAULT '0',
    `visits` int(11) NOT NULL DEFAULT '0',
    `timestamp` timestamp(14) NOT NULL,
    KEY `page` (`page`)
    )

    step 2.
    WP-GoogleStats 頁面下載 .phps 檔案並重新命名為 .php (mirror),將檔案放至 /wp-content/plugins/,於控制後台啟動。

    step 3.
    編輯 theme 底下的 footer.php,在 <div id="footer"> 範圍內任一地方加入

    <?php if (function_exists ('wp_ftr_googlestats')) wp_ftr_googlestats('l, F j, Y'); ?>

    'l, F j, Y' 為時間顯示的格式,可以參考 PHP.net 的 date 頁面。存檔後即可在首頁或文章底端看到效果。

    Posted in WP 速記
    by hsuyo

    [WP] 管理後台 Technorati Incoming Links 的問題

    Saturday, July 30th, 2005 at 9:04 am

    Max 告訴我他發現的這個問題,也就是在 WP 管理後台的 incoming links 會有錯誤,連結變成導向自己的網址,無法正確獲得所收到的新連結。我在 wordpress 論壇找到解決的方法,如下:

    1. 先找到並記下你的 Technorati API key
    2. 編輯 wp-admin/index.php,在約第 88 行可以找到

    $RSS = @fetch_rss('HTTP://feeds.technorati.com/cosmos/RSS/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');

    將其取代為 (code 皆為一整行):

    $RSS = @fetch_rss('HTTP://API.technorati.com/cosmos?key=你的 Technorati API key&URL=' . get_option('home') . '&type=weblog&format=RSS');

    存檔後功能就正常了。

    Posted in WP 速記
    by hsuyo

    隨機圖片 banner

    Saturday, June 4th, 2005 at 1:45 am

    參照 Matt 的作法,把 code 存成 PHP 檔 (ex: random.php)之後,與圖片放入相同的資料夾中即可。

    如果想隨機替換 WordPress 的 header 圖片,以 Kubrick theme 為例,修改 theme 底下的 header.php,將

    URL("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickheader.jpg")

    改成

    URL("<?php bloginfo('stylesheet_directory'); ?>/images/banner/random.php")

    再使用符合尺寸的圖片 (jpg、PNG、gif),或是 Digital Westex Image Gallery 的圖片,就能隨機顯示 banner 資料夾裡的圖片了。

    要注意的是主機流量會增加不少,所以圖片的容量最好不要太大,當然如果機器是自己的就沒差啦 XD

    Posted in 網頁調教
    by hsuyo

    WordPress 1.5.1.1

    Tags:
    Friday, May 20th, 2005 at 8:56 pm

    除了修正 William’s Blog 中提到的 RSS bug,也修正了精神奕奕提到的 trackbacks/pingbacks bug。神奇的是我都沒遇到,不過還是照著他們的方法將 bug 修正了。

    Posted in WP 速記
    by hsuyo

    [WP] User Online Plugin

    Sunday, May 15th, 2005 at 4:42 pm

    ricky 在留言板問了 User Online 的外掛,這是使用 WordPress 1.5 User Online,以下為簡易的安裝說明:

    Step 0.
    於 GameZ 的 programming 頁面 下載檔案: WordPress 1.5 User Online;

    Step 1.
    修改 wp-settings.php,尋找 Table names 底下的這一行:

    $wpdb->postmeta = $table_prefix . 'postmeta';

    在其下一行加入:

    $wpdb->useronline = $table_prefix . 'useronline';

    Step 2.
    放置壓縮檔裡的檔案:

    useronline-install.php 放入 wp-admin 資料夾
    wp-useronline.php 放入 WordPress 安裝根目錄下
    useronline.php 放入 wp-content/plugins 資料夾

    並在控制台啟用這個 plugin

    Step 3.
    於瀏覽器中瀏覽 http://你的blog網址/wp-admin/useronline-install.php
    執行後看到空白的頁面表示新的 table 已在資料庫中建立

    Step 4.
    於 header.php 或 sidebar.php 中加入

    <a href="wp-useronline.php"><?php get_useronline(); ?>

    即大功告成,可將 useronline-install.php 刪除或更名。

    Posted in WP 速記
    by hsuyo

    WordPress 1.5.1 released

    Tags:
    Tuesday, May 10th, 2005 at 4:46 pm

    升級一樣無痛,William’s Blog 也有相關的升級教學了,要注意的是這個方法只適用 WordPress 1.5 升級至 1.5.1

    [changelog]

    Posted in WP 速記
    by hsuyo

    [WP] 在首頁排除/指定特定分類文章

    Saturday, April 30th, 2005 at 12:20 am

    這個 plugin: Front Page Categories,其實是我為了解決裝了 Jerome’s Keywords Plugin 之後,與右側的隨地大小便分類所衍生出來的問題而找到的。

    由於我之前參考這篇文章: How do I hide a category from the front page (index.php) ?,利用其中的方法將隨地大小便的分類排除在首頁中 (也就是該分類的文章不會出現在 index.php 裡),但使用 Jerome’s Keywords Plugin 後,Tags 連結裡的該分類文章也會被排除掉。於是在 WordPress Forum 苦尋替代方法,最後在原本文章的留言找到了解答。

    Plugin 的安裝方法更簡單了,把頁面中的 code 存成 PHP,修改下面那行之後,放入 wp-content/plugins 資料夾:

    $cats_to_show = '1';

    將其中的數字替換成欲在首頁顯示的分類 ID,多個 ID 間使用空白 space 隔開 (分類 ID 可以在管理介面的 管理 > 分類 中找到。) 最後於外掛管理介面啟用即可。

    Posted in WP 速記
    by hsuyo

    [WP] Tag Your WordPress

    Friday, April 29th, 2005 at 11:28 pm

    之前看到 QQ 裝了 Jerome’s Keywords Plugin,感覺滿有用的,研究一下把它裝上了。

    keywords tags

    安裝方法很簡單,只要將解壓縮後的檔案放入 wp-content/plugins 資料夾裡,於外掛管理介面啟用後,便可以看到在發表文章的下方出現 Keywords 的輸入欄,如左圖。

    要讓這些 Keywords/Tags 顯示在文章上,必須修改 Theme 之下的 index.php 以及 single.php,使用 <?php the_post_keytags(); ?> 來呼叫,需注意的是 <?php the_post_keytags(); ?> 必須加在 loop 之間。

    再以 <?php the_post_keytags(); ?> 為例,可以加入 include_cats、local_search、linktitle 三種不同的控制參數,預設分別為: false (文章分類不列入 Tags 之中)、'tag' (Tags 的連結導向本地端)、'Search site for ' (滑鼠移至連結上時顯示 Search site for )

    作者 Jerome 舉了例子:

    example 1.

    <?php the_post_keytags(true); ?>

    文章分類列入 Tags 之中;

    example 2.

    <?php the_post_keytags(false, 'technorati'); ?>

    文章分類不列入 Tags 之中、Tags 的連結導向 Technorati;

    example 3.

    <?php the_post_keytags(true, 'tag', 'View all posts on geewhiz.com for '); ?>

    文章分類列入 Tags 之中、Tags 的連結導向本地端、滑鼠移至連結上時顯示 View all posts on geewhiz.com for 你的 Tag;

    如果不需改變,則直接使用 <?php the_post_keytags(); ?> 即可。

    最後,如果有使用 permalink,記得至後台重新更新一次狀態,或是手動 (個人建議) 將以下 code 加入你的 .htaccess:

    RewriteRule ^tag/(.+)/feed/(feed|RDF|RSS|rss2|atom)/?$ /index.php?tag=$1&feed=$2 [QSA,L]
    RewriteRule ^tag/(.+)/(feed|RDF|RSS|rss2|atom)/?$ /index.php?tag=$1&feed=$2 [QSA,L]
    RewriteRule ^tag/(.+)/page/?([0-9]{1,})/?$ /index.php?tag=$1&paged=$2 [QSA,L]
    RewriteRule ^tag/(.+)/?$ /index.php?tag=$1 [QSA,L]

    至於俏麗的 Tag Cosmos 的功能,我想用 Static Page 的方式來呈現,可是出現了一點錯誤,只好先擱一旁。 使用作者提供的檔案,將 cosmos.php 放入 theme 的資料夾下,再新增一個 page ,template 選擇 cosmos 使用即可!

    Posted in WP 速記
    by hsuyo

    [WP] 按下分類後只出現標題

    Friday, April 22nd, 2005 at 1:11 am

    回應如萍的問題

    其實很簡單,先找到所使用 theme 底下的 archive.php (非 archives.php !),開啟檔案並尋找:

    <div class="entry">
    <?php the_excerpt() ?>
    </div>

    將其刪去,存檔後,即可達到按下分類後只出現標題的效果。

    相關:
    [WP] 顯示分類項目中的所有文章

    Posted in WP 速記
    by hsuyo

    [WP] Asides for WordPress 1.5

    Monday, March 14th, 2005 at 10:39 pm

    什麼是 Aside? 可以看到 Photo Matt 中,許多沒有標題的文字,就是使用 Matt 的 On Asides,相關應用亦可見 中文 WordPress 右方的資訊欄。然而,原本 WP 1.2 的 Aside 方法在 WP 1.5 之後已經失效了。

    Max 上星期在留言中提供了 WordPress 1.5 使用 Asides,我在自己的機器上測試後可以使用,以 WP 1.5 預設的 Kubrick 主題,提供安裝筆記。

    事前準備:
    由於這個方法會修改 theme 當中的 index.php 檔案,建議先將其備份起來。

    Step 1.
    編輯 theme 底下的 index.php,尋找:

    <?php while (have_posts()) : the_post(); ?>

    在其之後加上:

    <?php if (in_category(10) && !$single) { ?>
    <ul class="asides">
    <?php echo wptexturize($post->post_content); echo ' '; comments_popup_link('(0)', '(1)', '(%)')?> <?php edit_post_link('(e)'); ?>
    </ul>
    <?php } else { ?>

    其中 10 就是會顯示成 Asides 的分類 id,你可以在管理介面的 管理分類 中找到。

    註: 原文為有加上 <li> 標籤,但我把它刪掉了。

    Step 2.
    同樣修改 index.php,於第一行加上:

    <?php function stupid_hack($str) {
    return preg_replace('|</ul>s*<ul class="asides">|', '', $str);
    }
    ob_start('stupid_hack');
    ?>

    Step 3.
    還是在 index.php 中尋找:

    <?php endwhile; ?>

    將其修改為:

    <?php } endwhile; ?>

    存檔後,Asides 的效果即大致完成。

    Step 4.
    以下為使用 CSS 修飾,參考這裡的作法,修改 style.css,選擇性加入:

    /* This is the styling for asides*/
    ul.asides {
    border: 邊框;
    font: 字型;
    font-size: 字型大小;
    font-color: #字型顏色;
    background: #背景顏色;
    background: URL(背景圖片) repeat center;
    margin: 外距;
    padding: 內距;
    }
    /*just to make it sit pretty*/

    /* to change the links: */
    ul.asides a {
    text-decoration:none;
    }
    /* end stylling for asides */

    註: 若於 Step 1. 有使用 <li> 標籤,則這裡的 ul.asides 應更改為 ul.asides li

    Posted in WP 速記
    by hsuyo

    [WP] 表情符號 wp-grins

    Friday, February 25th, 2005 at 5:25 am

    juusa 在留言裡問到:

    如果要顯示表情符號的話
    除了啟用wp-grins的外掛外
    還要貼語法在使用中的theme的index.php裡嗎?
    謝謝囉!!
    juusa ^^

    如果想在 WordPress 1.5 中使用 Alex King 的 WP Grins 外掛,則需要做以下改良,編輯 wp-admin/admin-functions.php,約在第 574 行的地方可找到:

    <script type="text/javascript">edToolbar();</script>
    ';

    在其下一行加入:

    if (function_exists("wp_grins")) { echo "
    "; wp_grins(); }

    完成,如此一來在發表文章的地方就有標情符號的快捷列了。

    如果要加在留言發表的地方,則編輯 comments.php
    把 <?php wp_grins(); ?> 加入於 textarea 標籤上方的位置即可。

    相關網頁:

  • wp-grins for 1.5 ?
  • Posted in WP 速記
    by hsuyo