WordPress Title 重複 的修復(Twenty Ten)

今天在找資料時發現到我的 WordPress Title 居然重複了一次, 如下述:

  • 首頁: <title>Tsung's Blog | 個人筆記, 記錄關於 系統、程式、新聞 與 日常生活 等資訊Tsung's Blog | 個人筆記, 記錄關於 系統、程式、新聞與 日常生活 等資訊</title>
  • 內頁: <title>文章標題 | Tsung's BlogTsung's Blog</title>

WordPress Title 重複 的修復(Twenty Ten)

此問題只有在 Twenty Ten 這個 Theme 會發生, 所以修正下述即可:

  1. vim wp-content/themes/twentyten/header.php
  2. 原始內容
    <?php
    // Add the blog name.
    bloginfo( 'name' );
    
    // Add the blog description for the home/front page.
    $site_description = get_bloginfo( 'description', 'display' );
    if ( $site_description && ( is_home() || is_front_page() ) )
    echo " | $site_description";
    ?>
  3. 修改成 (註解掉下述3行, bloginfo(), if (...), echo ...)
    <?php
    // Add the blog name.
    //bloginfo( 'name' );
    
    // Add the blog description for the home/front page.
    $site_description = get_bloginfo( 'description', 'display' );
    //if ( $site_description && ( is_home() || is_front_page() ) )
    //      echo " | $site_description";
    ?>
  4. 這樣子就完成囉~

作者: Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.

在〈WordPress Title 重複 的修復(Twenty Ten)〉中有 2 則留言

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料