WordPress 網誌有很多鏈結, 主要是方便讀者瀏覽網誌內的其他文章。 如果從讀者的角度來看, 這真是十分方便。 但如果從搜索引擎優化的角度來看, 這並不是一個好的設計, 因為這會製造了大量重複的鏈結。今天討論如何刪除在 WordPress 文章內一些不必要的鏈結。

網誌文章底部的鏈結

網誌文章底部的 “This entry was posted in……” 鏈結, 如下圖所示, 其實可以刪除。

刪除 WordPress 的 This entry was posted in 及Posted in 鏈結

要刪除 “This entry was posted in……” 的鏈結是十分容易, 只要更改使用中的 WordPress 佈景主題內的 functions.php 檔案便可以了。

用文字編輯軟件 (text Editor) 開啟 functions.php 檔案, 瀏覽至 489 – 510 行, 如下圖:

刪除 WordPress 的 This entry was posted in 及Posted in 鏈結

第 500行 – 506行的程式碼便是用來顯示”This entry was posted in……” 的鏈結。 所以只要將這幾行的程式碼刪除便可以了;  當然, 最佳的方法是將這幾行的程式碼用 “/* */” Comment 了便可以了, 如下圖。

刪除 WordPress 的 This entry was posted in 及Posted in 鏈結

結果如下:

刪除 WordPress 的 This entry was posted in 及Posted in 鏈結

網誌文綜合頁內文章底部的鏈結

網誌文綜合頁內所有文章底部的 “Posted in……” 鏈結, 如下圖所示, 其實也可以刪除的。

刪除 WordPress 的 This entry was posted in 及Posted in 鏈結

要刪除 “Posted in……” 的鏈結是十分容易, 只要更改使用中的 WordPress 佈景主題內的 loop.php 檔案便可以了。

用文字編輯軟件 (text Editor) 開啟 loop.php 檔案, 瀏覽至 151 行, 用 “/* */” Comment 了這行便可以了, 如下圖所示:

刪除 WordPress 的 This entry was posted in 及Posted in 鏈結

看看結果如何。

刪除 WordPress 的 This entry was posted in 及Posted in 鏈結

WordPress 網誌內的 “Posted in……” 的鏈結沒有了!