為什麼要有測試站點?

為什麼要有測試站點?

為什麼我應該有一個測試站點?

許多 wordpress 使用者只有一個實時站點,並在該站點上進行所有更改。在絕大多數情況下,這很好,而且效果很好。

但是 wordpress 論壇每天都有來自 WordPress 管理員的帖子,他們在他們的網站上進行了一些更改,但現在無法正常工作。

WordPress 核心非常強大,但是為了製作一個 wordpress 站點,我們大多數人都會新增主題和外掛 (包括 bbPress),而這些是由許多不同的人編寫的。我們也可以透過新增 css 或新增函式來自己進行更改。 WordPress 還使用多種語言,將所有這些元素結合在一起意味著錯誤可能會蔓延。

因此,以下所有情況都可能導致問題:

  • 更新 wordpress 核心
  • 更新外掛
  • 更新主題
  • 新增外掛
  • 改變主題
  • 更改或新增功能
  • 更改或新增 css

雖然在大多數情況下這一切都很好,但所有這些都可能導致任何問題,從輕微的佈局問題到最壞的 「白屏宕機」(稱為 WSOD),您的網站只顯示一張空白的白紙。

對許多人來說,這是他們第一次遇到問題,他們不熟悉 FTP 和 PHPmyadmin,並且對於一個通常無法執行或看起來非常錯誤的實時站點,他們既感到恐慌、沮喪,又需要緊急幫助。

破壞您的實時站點也會在最不方便的時刻發生 - 只需兩分鐘的簡單快速外掛更新剛剛破壞了您的站點,您現在應該在十分鐘內出去吃晚飯,而您的另一半正在對您大喊大叫,讓您做好準備。

擁有測試站點意味著您可以更新 WordPress,新增或更新外掛和主題,並確保它們在您實時執行此操作之前正常工作。如果它破壞了您的測試站點,您可以花時間找出問題所在,同時您的實時站點仍能正常執行。

但是擁有一個測試站點可以讓您做更多、更多的事情。您可以測試 WordPress 、主題和外掛設定更改以檢視它們的作用;嘗試更改樣式以檢視它們的外觀;更改您的函式檔案並新增新函式;建立一個子主題並玩弄您網站的外觀和功能;新增新的 .php 檔案並在其他人看到它們之前測試它們。

當然,您可以在閒暇時執行此操作,不再需要快速嘗試某些內容,然後在您不喜歡的情況下還原您的站點。您可以做一半的更改,稍後再回來修補它。

如果以上所有內容都不能讓您相信您不僅想要一個測試站點,而且絕對需要一個,那麼讓我補充一個關鍵點——備份。

現在您可能依賴您的主機提供商來備份您的站點,我懷疑所有主機提供商都會至少每天備份您的站點。如果您的網站因為您嘗試更新外掛而出現故障並且您的網站凍結,他們會讓您恢復到昨天的版本 – 是嗎?

嗯,可能是這種情況,但是您的提供商會在幾分鐘內完成嗎?他們會一天 24 小時這樣做嗎?他們甚至在您的時區嗎?昨天的備份是否足夠好?– 是的,它可能會讓您回到更新該外掛之前的位置,但是您是否會丟失花費數小時撰寫的部落格條目,是否會丟失論壇帖子、商店訂單、讀者發表的評論、您擁有的設定改變了,css 和函式檔案?– 事實上,今天您網站上的無數事物可能與昨天不同。

最終,如果您的主機提供商破產,那麼您不僅失去了您的站點,而且他們將沒有工作人員為您提供站點的副本,以便您可以在其他地方進行設定。

因此,依靠您的主機提供商進行備份並不是一個好策略。

因此,您自己進行備份 - 是嗎?有很多備份產品,而且很多都可以作為外掛使用。您也可以自己備份 WordPress,並複製您的資料庫。

通常對於所有這些方法,您會將它們儲存到您的 PC 中,或者現在越來越普遍地儲存到 「雲」 中。但影印只是解決方案的一半。複製是否有效,您是否測試過,您知道如何進行還原嗎?這些不是您想要在現場測試或在您的網站關閉時第一次嘗試的東西。那麼您怎麼知道您的備份夥伴 (可用的備份外掛之一) 副本是否會在需要時實際恢復?

當我第一次開始使用 WordPress 時,我使用了這個外掛,但發現我複製的一個副本根本無法恢復——如果那是我的關鍵副本,並且我的實時站點已關閉,然後我需要走得更遠。幸運的是,我有很多其他備份夥伴副本,它們執行良好。

或者,如果您複製資料庫,您怎麼知道它們沒有損壞,或者我發現它們太大而無法一次性恢復到我的資料庫中。

除非您定期測試備份以檢視它們是否有效,否則您既不知道副本是否正常工作,也不習慣恢復過程。這兩個都是關鍵要求,如果不確定您是否可以恢復,您的備份充其量只是一種希望。

因此,測試站點可讓您測試恢復備份 – 不是每天,但您當然應該測試恢復,比如每月一次,讓您感到高興,如果最壞的情況發生,您可以應對。

因此,如果我現在已經說服您應該擁有一個測試站點,那麼您會想知道如何建立一個。

回到建立測試站點

支援論壇

支援論壇

此頁面是支援論壇的歡迎資訊 。本介紹旨在幫助您在論壇中找到自己的方式,並希望讓您儘快入門。 bbPress 支援論壇將遵循 WordPress 支援論壇制定的相同規則和準則。請閱讀這兩頁以熟悉這些指南。使用支援論壇和  論壇歡迎

歡迎論壇志願者

感謝您花時間在 bbPress 論壇上提供支援。請注意,WordPress 支援論壇中設定的規則和指南也適用於此處。以下文件將幫助您瀏覽我們的論壇。

1. 論壇歡迎 ——本文件部分針對那些在論壇上尋求支援的人,但包含有關幫助、何時可以刪除或關閉話題以及報告執行緒等的資訊。除非問題特定於 WordPress,否則請忽略郵件列表資訊。

2. WordPress 支援手冊 ——其中包含大量文章,可幫助您為 「WordPress 方式」 提供支援。您可能想先閱讀的一些文章:

論壇版主

感謝您接受邀請成為我們支援論壇的版主 ????

請花點時間閱讀上面和下面的推薦文章,重新熟悉我們的論壇規則。如果您有任何問題或建議,請隨時聯絡 bbPres 核心團隊。

附加參考:關於提問的公認約定

閱讀下面的這份文件是值得的,它可以作為在論壇和列表上提問的正確方法的入門指南。雖然它的目標是將海報作為指導如何表現和形成一個將獲得積極響應的問題,但它對所有人都非常有用,並被視為 RFC:
如何以聰明的方式提出問題

備份您的資料庫和檔案

備份您的資料庫和檔案

定期備份您的資料庫和站點檔案對於能夠從伺服器崩潰、站點被駭客入侵或人為錯誤等悲慘事件中恢復至關重要。您需要從站點備份兩個重要區域,即資料庫資料和 WordPress 檔案。建立站點備份的方法有很多種,您可以使用外掛來建立站點備份以允許您自動備份,也可以手動建立備份,我們將在本指南中討論這兩種方式。

建議您保留站點的多個備份,以防其中一個備份損壞或丟失。還要確保定期安排備份,並儲存在不同的介質上,如 CD 、拇指驅動器、電子郵件和雲端儲存 (如 Dropbox 等) 。

有關備份站點的更多資訊,您還可以按照 WordPress 指南 WordPress 備份進行操作

備份您網站的檔案

使用 FTP 手動備份檔案

您可以使用 FileZilla 等 FTP/SFTP 客戶端,將所有站點檔案下載到計算機上的資料夾中。例如,您可以只下載您建立/上次修改的檔案,如自定義 bbPress 模板或新增到 bbPress 樣式表的自定義樣式。無需複製 WordPress 核心檔案,因為您可以從 wordpress.org 全新下載的 WordPress zip 檔案中替換它們。要備份的最重要的檔案之一是 wp-config.php 檔案,因為該檔案包含有關資料庫配置的資訊以及有關如何設定站點的其他選項。其他重要檔案位於 wp-content 資料夾中,其中包含所有已安裝的主題、外掛和所有上傳媒體。

在某些情況下,您不必下載站點的所有檔案,除非您安裝了新外掛或修改了主題。預設情況下,WordPress 按一年中的幾個月對您的媒體檔案進行存檔,如果您上個月備份了您的網站,則無需下載舊的媒體媒體檔案。

有關如何備份檔案的更多資訊,您還可以按照此 WordPress 指南 備份您的 WordPress 檔案

備份站點檔案和資料庫的自動化解決方案

有大量非常好的免費外掛可以在這裡備份 WordPress 外掛儲存庫中的資料庫和檔案。但如果您正在尋找自動化的高階服務,請考慮使用 Automattic 的 VaultPress

備份您的 WordPress 資料庫

資料庫是您站點的重要組成部分,因為它在一堆表中包含您的所有站點資料,通常在預設 WordPress 安裝中以 wp_ 為字首。當您的使用者建立話題、回覆,甚至只是有關使用者的資訊時,所有這些都儲存在 WordPress 資料庫表中。

使用 phpMyAdmin 手動備份資料庫

以下是手動備份資料庫的分步指南。有關使用 phpMyAdmin 手動備份資料庫的更多詳細資訊,請聯絡您的託管服務提供商或閱讀以下 WordPress 指南 備份您的資料庫

備份資料庫的自動化解決方案

這些只是僅備份資料庫的外掛

  • WP-DBManager – 這提供了一個功能齊全的前端介面來管理您的資料庫,您可以透過這個外掛最佳化、修復、備份、恢復、刪除表和執行選定的查詢。這很方便,但請在安裝前閱讀外掛主頁上的免責宣告。

另請注意,WordPress 的許多頂級安全外掛也有備份/恢復資料庫的選項。

恢復您的網站

您需要學習如何備份您自己的站點檔案並知道如何恢復它們,以便如果有一天您需要恢復您已經準備好的站點備份。因此,請嘗試進行測試備份並正確恢復,以便您熟悉備份軟體的工作原理。

請注意,僅將恢復作為最後的手段,如果問題只是來自一個簡單、易於修復的問題,則只需修復該問題。在站點恢復期間,您將丟失自上次備份以來的所有新資料。

例如,如果您在週一進行了備份,而您的站點在週三由於編輯模板檔案時的輕微 PHP 問題而出現錯誤,則不要恢復週一的備份,否則您將丟失週二和週三的所有資料,只是一個未成年人可以輕鬆解決的問題。

使用 FTP 手動恢復您的檔案

只要您剛剛從您的站點下載 wp-content 資料夾和 wp-config.php 檔案進行備份,那麼恢復就像將檔案複製回您的 WordPress 站點一樣簡單。然後,上傳 wp-content 資料夾中的其餘檔案,例如外掛和主題,以及您的媒體檔案。

使用 phpMyAdmin 手動恢復資料庫

按照 WordPress Codex 指南使用 phpMyAdmin 恢復資料庫,從備份恢復資料庫

備份資料的其他方法

WordPress 後端匯出工具

WordPress 提供了一種透過將 bbPress 帖子匯出到 XML 檔案來匯出資料的方法。您可以在 WordPress 後端的工具 > 匯出中找到它。這只是備份站點的快速方法,不能替代完整備份過程。它只備份網站上的內容而沒有資料庫資訊,最好將其視為恢復一些可能已丟失且無法從帖子修訂表中恢復的帖子的快速方法。

主機提供的備份軟體

大多數 WordPress 託管服務提供商都提供有限的備份服務來備份您的站點。請務必聯絡您的託管服務提供商以瞭解他們提供的備份服務。

請記住,備份您的網站是您的責任,不要僅僅依賴您的託管服務提供商進行備份。

其他資源

測試您的 bbPress 安裝

測試您的 bbPress 安裝

無論您是在開發外掛、建立主題還是為 bbPress 的核心做出貢獻,您都可能需要先學習如何對其進行測試並習慣其功能。

建立測試站點

從嘗試學習 bbPress 工作原理的初學者到想要為 bbPress 開發的高階使用者,建立測試站點非常有用。

建立測試資料

您是否已經建立了一個測試站點,並且想要使用一些演示資料自動填充 bbPress,以便您可以檢視 bbPress 的外觀、執行和執行情況。然後按照這些方法建立一些測試資料。

建立測試站點

建立測試站點

建立測試站點非常有益,因為您可以瞭解 bbPress 和 WordPress 的工作原理,並同時測試它們。

  • 對於開發人員來說,建立一個測試站點可以幫助他們為 bbPress 開發外掛或主題。
  • 對於常見的 WordPress 站點調整器,它可以在將更改傳輸到實時站點之前在其測試站點上測試簡單的樣式或功能更改。
  • 更重要的是,建立一個測試站點將允許您測試外掛/主題升級的問題,以便更新不會使您的實時站點容易受到駭客的攻擊或破壞您的站點。

這個簡單的過程應該可以幫助您自信地升級,並且可以更大膽地使用您的站點,首先測試測試站點中的所有內容,只有在您對一切正常工作感到滿意後才提交到實時站點。

如果您不相信您需要一個測試站點,那麼請閱讀我的推理:為什麼要有一個測試站點?

建立測試站點有兩種流行的選擇:

  1. 在您的計算機上安裝本地伺服器環境客戶端
  2. 使用現有域的子域。

本地安裝

在您的計算機上建立測試站點是購買新域的一種很好且免費的替代方法。如果您想走這條路,您需要安裝一個支援您的作業系統的應用程式,並允許您執行主機伺服器通常安裝的軟體來在您的計算機上執行測試站點。

每個應用程式透過它支援的作業系統識別自己,並安裝軟體,包括  A pache 、 M ySQL 和 P HP(XAMPP 還包括 P erl) 。以下是流行的本地伺服器環境客戶端列表,以及 WordPress 手冊中的指南連結,可幫助您安裝每個應用程式。

最流行的本地伺服器包是:

  • WAMP – 適用於 Windows
  • MAMP – 適用於 Mac
  • XAMPP – 適用於 Windows 、 Mac 和 Linux

建立測試站點並使用列出的軟體應用程式之一在您的計算機上安裝 WordPress 後,您可以安裝 bbPress 並對其進行測試。您可以看到外掛如何與 bbPress 一起工作,主題如何工作,您還可以為 bbPress 開發外掛或主題。

現有域的子域

子域將您的主域用作單獨的站點。因此,如果您建立一個名為 「test」 的子域,那麼您將使用 「test.mysite.com」 作為訪問該站點的 URL 。

大多數主機提供商允許您建立子域。如果您訪問您的託管區域,您應該會找到建立子域的選項。如何執行此操作因主機提供商而異,因此如果您需要任何幫助,請聯絡主機提供商的支援以獲取有關如何為當前設定建立子域的任何資訊。

建立後,您可以建立測試站點並獲得以下好處:

  • 測試任何效能問題
  • 包含外部源 API 的測試外掛

克隆現有站點

透過克隆或映象您的實時站點,您可以先在測試站點上測試任何修改/升級,而不會影響您現有的實時站點。

所以您可以測試:

  • 主題和外掛的新升級
  • 新增並測試任何新外掛
  • 更改已安裝的 WordPress 主題
  • 新增 css 、更改功能、佈局以及與現有 WordPress 站點有關的任何內容

因此,您將首先僅在測試區域提交,如果您對結果感到滿意,則可以將這些更改轉移到您的實時站點。而且,如果外掛有新的升級,您可以先在您的測試站點上測試升級,如果升級導致問題,您將知道在問題解決之前不要在您的實時站點上升級。

複製資料

所以現在您有一個測試域,其中包含您網站上的所有檔案和資料夾,但您需要複製資料。

嘗試操作

  1. 使用 phpMyAdmin 訪問您的實時站點的資料庫。
  2. 接下來,在左側,您將看到所有建立的資料庫。
  3. 查詢並選擇您的實時站點的資料庫,您現在將看到來自該資料庫的一系列表格。
  4. 您將在頂部的選單中看到一個匯出選項。單擊它後,您將看到一些選項。
  5. 現在您可以進行快速匯出,但我認為不建議這樣做,我更喜歡您進行自定義匯出,以允許您將資料壓縮為 zip 格式並新增任何其他值以改進恢復。
  6. 所以現在啟用 Custom 。
  7. 通常,您可以將資料庫匯出到單個包中,但是如果您有一個特別大的資料庫,您可能無法一次性匯出/匯入。在匯入過程中,您可能需要複製單個資料庫表或對錶進行分組。但是,您可以先嚐試匯出所有表以進行測試並確保一切正常。
  8. 在 「輸出」 部分中,選擇您選擇的 zip 格式來壓縮您的資料庫資料。這可能會顯著增加大型資料庫的上傳時間。它還可以讓您克服主機提供商可能設定的某些檔案上傳大小限制。
  9. 在物件建立選項中,啟用新增 DROP TABLE/VIEW /PROCEDURE/FUNCTION/EVENT 語句。在匯入過程中,這將在恢復新表之前刪除所有現有表,確保匯入乾淨。
  10. 現在單擊 Go,檔案將下載到您的計算機上。

匯入資料

已經以壓縮檔案格式下載了資料庫資料,您現在可以將資料匯入到新的或現有的資料庫中。

如果您尚未建立新資料庫。

  1. 轉到 phpMyAdmin 主頁。
  2. 單擊頂部的資料庫選單項
  3. 您現在將看到一個用於建立新資料庫的區域以及一個用於命名資料​​庫的文字輸入。
  4. 為測試站點的新資料庫建立一個新名稱。將下拉選單保留為 Collat​​ion 的預設設定,然後單擊建立按鈕。
  5. 您剛剛建立了新資料庫。

將資料匯入新資料庫。

  1. 為您的測試站點選擇您最近建立的資料庫。
  2. 單擊頂部的匯入選單項
  3. 現在單擊 「選擇檔案」 按鈕 ,然後從下載中選擇實時站點的資料庫資料。
  4. 單擊 「前往」 按鈕。等待匯入完成,然後您應該會看到一條成功訊息。
  5. 現在,您已將實時站點的資料庫資料匯入到測試站點資料庫中。

更改站點引用

由於活動站點的資料已匯入到測試資料庫中,您將在 wp_options 表中看到您的活動站點的 url 。如果您不更改這些,您將被重定向到您的實時站點,因此更改它是關鍵。

  1. 在 phpmyadmin 中選擇您的測試站點資料庫
  2. 單擊最頂部的 SQL 選單項
  3. 現在在空框中輸入以下 SQL 程式碼
UPDATE wp_options SET option_value = REPLACE(option_value, 'LIVESITE_URL', 'TESTSITE_URL'); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'LIVESITE_URL', 'TESTSITE_URL'); UPDATE wp_posts SET guid = REPLACE(guid, 'LIVESITE_URL', 'TESTSITE_URL'); UPDATE wp_posts SET post_content = REPLACE(post_content, 'LIVESITE_URL', 'TESTSITE_URL');

TESTSITE_URL 是您的測試站點的完整 URL 地址。

LIVESITE_URL 是您的實時站點的完整 URL 地址。

如果您對測試站點的資料庫使用不同的內容,則可以更改 wp_ 字首。

安裝 WordPress

完成建立測試站點的資料庫後,您需要安裝 WordPress 。這將允許您在安裝期間輸入新資料庫資訊。您可以手動執行此操作,也可以使用主機提供的 WordPress 安裝過程。
傳輸檔案

  1. 首先使用 FTP 或 SFTP 客戶端下載您的實時站點的 wp-content 資料夾的副本。
  2. 然後將您下載的資料夾內容上傳到您的測試站點的 wp-content 資料夾。所有重要的檔案,如主題、外掛和媒體上傳都將透過此傳輸。

其他步驟

設定測試站點後,您需要禁止使用者訪問和搜尋機器人索引測試站點。

  1. 在儀表盤 > 設定 > 閱讀中更改搜尋引擎可見性以阻止搜尋引擎索引您的測試站點。並且保持禁用任何 SEO 外掛/功能應該會有所幫助。
  2. 由於這是一個測試站點,您不會允許任何人註冊到您的站點。因此,安裝 Restrict Site Access 將允許您將站點限制為您的 IP 地址,並且只允許您訪問您的測試站點。

函式檔案和子主題 - 解釋!

函式檔案和子主題 - 解釋!

建立子主題和函式檔案

許多 wordpress 和 bbpress 支援答案告訴您將一些程式碼新增到您的函式檔案或 style.css 但是什麼是函式檔案,什麼是 style.css 檔案 - 我如何建立它們以及將它們放在哪裡?

本教程希望回答所有這些問題以及更多問題!

什麼是函式檔案?

函式檔案只是一個名為 Functions.php 的檔案,它位於您的主題中。這使您可以向 wordpress 和 bbpress 新增其他功能,而無需更改這些檔案中的程式碼。如果您更改 bbpress 和 wordpress 中的程式碼,它可能會在任何更新時被覆蓋,並且您將丟失它。

現在由於函式檔案屬於主題,它同樣有可能在主題升級時被覆蓋,因此出於這些原因,最好的做法是建立一個子主題 (如果您還沒有),並在其中放置一個函式檔案。

什麼是 Style.css 檔案?

每個主題都有一個 style.css,但外掛也可以新增額外的樣式檔案。這些檔案共同決定了頁面的外觀,例如元素在頁面上的位置,是否有任何填充以使其與其他文字分開,文字應該是什麼字型、顏色和大小,各種標題的樣式等. 樣式檔案也可以隱藏東西,所以有時我們可能會建議您將元素更改為 'display:none' 以便它被隱藏。與函式檔案一樣,樣式檔案可能會被主題或外掛升級覆蓋,因此不建議為不是您自己編寫的主題或外掛帽更改這些檔案。因此,與函式檔案一樣,最好的做法是建立一個子主題 (如果您還沒有),並且為此您將擁有一個用於該主題的 style.css 。

我已經有子主題了嗎?

所以首先我們需要看看您的主題是什麼,是父主題還是子主題。如果它是父主題,那麼您應該建立一個子主題,將函式檔案新增到該子主題並將您的更改放在那裡。如果您更改父主題中的任何檔案,您可能會在更新或升級時丟失更改。所以您不想改變父主題檔案。

您的 wordpress 主題

首先,您的 wordpress 安裝將使用 「主題」——這是一組檔案,用於設計您的網站 (外觀) 並新增一些功能 (如何執行) 。

您可能正在使用 「預設主題」20 、 21 、 21 、 23 和 24 之一。這些主題由 wordpress 團隊編寫和維護,所有 wordpress 和 bbpress 程式碼都針對這些主題進行測試以確保其正常工作。這就是為什麼經常要求您使用 「預設主題」 測試 bbpress 問題的原因,作為調查過程的一部分。

或者,您可能正在使用 「免費主題」 。其中許多都可以在 https://wordpress.org/themes/ 上找到  。

第三,您可能正在使用付費主題。這些往往更復雜,並提供很多好東西,但與 bbpress 的整合可能更復雜。如果 bbpress 對您的網站很重要,則值得在購買之前檢查您的付費主題是否積極支援 bbpress 。大多數主題可以透過一些調整與 bbPress 一起使用,但最初讓它執行並且看起來很棒真的很令人沮喪。

最後,您可能正在使用子主題。很簡單,這是一個主題,它使用上述之一 (預設主題、免費主題或購買的主題) 作為基礎,然後進行了更改。如果您花錢請人為您建立或定製一個站點,那麼它很有可能是一個子主題。

那麼您怎麼知道您在使用哪個?

最快的方法是進入

儀表盤> 外觀> 主題

您將看到站點上安裝的主題列表,您將看到列出的第一個主題是 「活動的」,這就是您的站點正在使用的主題。

如果您將滑鼠懸停在活動主題上,它將顯示 「主題詳細資訊」,如果您單擊它,您將獲得有關該主題的一些資訊。

如果它是由 「wordpress 團隊」 提供的,那麼您就會知道它是預設主題。否則進入 https://wordpress.org/themes/並搜尋它。如果它在那裡,那麼它是一個免費的主題。最後,如果您在 google 上搜尋主題名稱,您應該找到一個賣家,或者至少提供一些支援細節,告訴您其他人已經編寫了這個主題。

如果其中任何一個顯示,那麼您的父主題在其他地方得到支援,並且它們可能會發布更新,因此如果您更改其中的任何檔案,您可能會在更新或升級時丟失更改。所以您不想改變這些檔案。

如果您無法透過上述任何一種方法找到您的主題,或者您知道有人專門為您更改了主題,那麼很可能這是一個子主題,因此不應由任何外部人員更新,因此您應該能夠無所顧慮地進行更改。

所以最後的測試是檢查您的主題是否已經是子主題,我們將準備繼續。所以現在您需要能夠進入 FTP,並將檔案傳輸到您的 PC,以便您可以檢視它以閱讀標題。

什麼是 FTP 以及如何訪問它?

要訪問您的檔案,您需要一個 FTP 客戶端。一些主機提供商在其管理範圍內進行處理,如有疑問,請諮詢您的主機提供商。

否則,您需要將程式載入到您的 PC 上。有幾種可用,但最受歡迎的一種稱為 「Filezilla」 。

要了解如何下載此程式並在您的 PC 上使用它,以下影片將有所幫助

http://www.youtube.com/watch?v=Wtqq1Mn1ltA

還有很多其他教程 - 只需谷歌 「filezilla 教程影片」

其他 FTP 程式也可用,只需谷歌 「FTP 客戶端」

要訪問您的網路檔案,您需要三項資訊:

  • 主持人
  • 使用者名稱
  • 密碼

注意:FTP 使用者名稱和密碼與您的 wordpress 登入名/wp-admin/admin 詳細資訊完全分開。

您的主機提供商通常會在您的管理區域中列出它,因此只需四處尋找 FTP,如果有疑問,請聯絡您的主機提供商。

然後跟著教程

https://make.wordpress.org/training/handbook/theme-school/child-themes/

或檢視影片

https://www.youtube.com/watch?v=yDPbCV5_2Cw

如果您的主題如步驟 2 所示匯入了另一個主題,那麼您已經有了一個子主題。

如果沒有,上面的教程將向您展示如何製作一個。

最後,您將擁有一個帶有 style.css 檔案的子主題

使用記事本++更改程式碼

由於您將要建立或更改檔案,因此您需要有人來執行此操作。可以使用普通的記事本,但大多數情況下您將無法閱讀,並且您會弄得一團糟。

所以從 http://notepad-plus-plus.org/下載 Notepad++

它易於使用,而且更好!

將函式檔案新增到您的子主題

如果您已經有一個子主題,那麼您可能已經有一個函式檔案,只需在您的主題資料夾中查詢一個名為 functions.php 的檔案即可。

如果不是,您將需要建立一個函式檔案。

只需開啟記事本++,建立一個新檔案並放入

 <?php

在開始時。現在將其儲存為 functions.php 並將其上傳到您的主題。就是這樣。您現在有了一個函式檔案!

將程式碼新增到函式檔案

好的,現在當您看到 「將其新增到您的函式檔案」 時,您就會知道您需要使用 FTP 將當前的函式檔案下載到您的 PC 上。然後使用記事本++將程式碼複製到函式檔案的末尾。然後使用 FTP 將修改後的檔案上傳回您的站點以覆蓋舊檔案。

將樣式新增到 style.css

由於您現在將 style.css 作為子主題的組成部分,您可以向該檔案新增任何更改。

 

 

就是這樣……!!

匯出資料

匯出資料

匯出您的 bbPress 資料 (論壇、話題和回覆對於快速備份或從一個安裝了 bbPress 的 WordPress 站點遷移到另一個站點非常有用。

  1. 登入您的 WordPress 後端。
  2. 轉到工具 > 匯出
  3. 您將看到一個螢幕以選擇要匯出的內容。您可以選擇按每個文章型別匯出 bbPress 內容,也可以一次匯出所有內容。
  4. 選擇要匯出的內容後,單擊 「下載匯出檔案」 按鈕。
  5. 現在您應該下載檔案,稍後您可以透過轉到 「工具」>「匯入」 將其匯入到另一個站點

故障排除

故障排除

bbPress 可以很好地與許多主題和外掛配合使用,但無法測試它們的所有組合,許多常見問題都是由外掛和主題衝突引起的。

某些問題的最常見解決方案是完成這些基本的故障排除步驟。

請注意,如果您使用的是付費主題或外掛,請聯絡作者尋求解決方案,因為他們可能知道如何修復它。

常見問題

這些是您需要檢查的常見問題。

外掛

有時外掛可能與 bbPress 衝突並導致您的網站出現問題。按照這個簡單的過程查詢外掛問題。

  1. 轉到外掛 > 已安裝的外掛
  2. 現在批次選擇除 bbPress 之外的所有外掛,在下拉選單中選擇 Deactivate 並點選 Apply,然後看看這是否能解決您的問題。

如果這解決了您的問題,請透過一次單擊一個外掛的啟用來重新啟用您的外掛,以檢視是哪個導致您的問題發生。

如果您發現問題是由您當前安裝的外掛生成的,請聯絡導致問題的特定外掛的外掛作者。看看他們是否知道任何修復程式,或者他們是否在 bbPress 中發現了錯誤,以便 bbPress 可以在不久的將來應用補丁。您還可以安裝導致問題的外掛的替代品,或者只是將其刪除,僅此而已。

如果您無法停用外掛。因為您無法到達螢幕來停用它們,那麼您可以使用 FTP. 或 phpMyAdmin 停用您的外掛。這是幫助您執行此操作的 WordPress 程式碼指南,如何使用 FTP 和 phpMyAdmin 停用外掛

主題

如果外掛沒有查明問題,作為測試切換到 WordPress 預設主題,例如 2012,看看這是否能解決您的問題。我們推薦二十二的原因是因為它與 bbPress 外掛完美配合。

  1. 轉到外觀> 主題
  2. 如果您已經安裝了二十二,點選主題截圖照片附近的啟用按鈕。如果您還沒有安裝二十二,現在就安裝。單擊站點主題部分頂部的新增新按鈕。現在在主題搜尋搜尋欄中搜尋二十二。搜尋後,如果拼寫正確,它應該是第一個選項。從那裡,單擊 「安裝」 按鈕 ,然後在安裝後單擊 「啟用」 以使 「二十二」 成為您當前的活動主題,然後看看這是否能解決您的問題。

如果您發現問題是由您當前安裝的主題產生的,請聯絡導致問題的特定主題的主題作者。看看他們是否知道任何修復程式,或者他們是否在 bbPress 中發現了錯誤,以便 bbPress 可以在不久的將來應用補丁。您也可以為您的網站安裝和使用完全不同的主題。

如果這不能解決您的問題,並且您也已完成外掛衝突的故障排除步驟,請嘗試以下附加解決方案。

其他解決方案

以下不會造成任何傷害,因此值得一試並可以解決一些問題。

  • 轉到 Settings > Permalinks,選擇預設的永久連結然後儲存。現在選擇您喜歡的永久連結結構。這會重新整理重寫規則並可以解決一些可能的 404 錯誤。
  • 轉到 「工具」>「論壇」>「修復論壇」 並一次執行一項修復工作。大多數修復工作只會重新計算帖子關係、帖子計數,並刪除將位於使用者個人資料中的使用者訂閱和收藏夾中的任何垃圾帖子。執行這些可以時不時地執行。

請注意,執行將 現有使用者重新對映到預設論壇角色 可能會刪除任何具有管理員分配的論壇使用者角色 (例如,主持人、被阻止、旁觀者、不是站點管理員的鍵盤管理員) 並且本身不是管理員的使用者,回到在 Settings > Forums > Auto Role 中設定的預設論壇角色。任何站點管理員都將被自動授予 Keymaster 論壇角色。

如果您確實執行了此修復作業並丟失了管理員為您的使用者分配的論壇角色,要修復它,您只需透過編輯每個使用者個人資料或從站點前端或後端的 bbPress 論壇個人資料手動重新分配它們。

  • 重新整理您可能擁有的任何快取,並確保您的快取外掛配置正確。
  • 檢查伺服器中的任何錯誤日誌。
  • 作為最後的手段,重新安裝 bbPress 的新副本。

高階故障排除

如果您在編碼方面有經驗,並且瞭解當這些選項彈出其資訊時要查詢什麼,那麼這些推薦選項可用於診斷您站點上的問題。

使用 WP_DEBUG

透過進入 wp-config 檔案並將 WP_DEBUG 值設定為 true,您可以啟用 WP_DEBUG 以獲取有關站點上任何問題的非常有用的除錯資訊。請確保這僅適用於非生產環境,因為您的使用者也可以看到除錯資訊。

define( 'WP_DEBUG', true );

執行此操作後,轉到出現問題的位置,您應該檢視是否存在導致問題的任何詳細資訊。完成後,確保透過將值設定為 false 來禁用此 WP_DEBUG 。

診斷 JavaScript 錯誤

如果您遇到某些互動功能的問題,這可能是由於某些 JavaScript 錯誤造成的。這個 WordPress 程式碼指南將有助於向您展示如何診斷不同瀏覽器中的 JavaScript 問題。使用瀏覽器診斷 JS 錯誤

其他資源

如果您需要任何其他幫助,請在支援論壇中建立話題。

如果您已經解決了自己的問題,請在支援論壇中告訴我們,以便您可以幫助可能遇到相同問題的其他使用者。

Step by step guide to setting up a bbPress forum – Part 1

Step by step guide to setting up a bbPress forum – Part 1

Step by step guide to setting up a bbPress forum – Part 1
Codex Home → Step by step guide to setting up a bbPress forum – Part 1
bbPress is a plugin for WordPress that adds forum capability to your site.
bbPress inherits your currently active theme』s styles where it can to try and match your themes style. This can work really well on some themes, but sometimes doesn』t work well on others, so some styling may be needed. Out of the box, it works well with most of the default WordPress themes , but like I said it might need minor CSS styling to fix some layout issues.
Setting up WordPress requires some or all of the following stages depending on how you want it to look.
The instructions here generate a forum working within a twentyten theme that looks like:

 
In summary you need to

Install the plugin
Set up some test forums or import a forum
Create a WordPress page for your forum display
Amend any other settings
Hidden vs. public forums – decide which or a mixture suits you
Decide on registration/user logins – automatic or manual?
Manually adding users to your forum – if you have chosen this route.
Make sure bbPress uses the page template we want
Add a custom sidebar or use existing sidebar with conditional logic

So let』s get started.
 
1. Installing the plugin
So we』ll assume you have a site with wordpress installed
Go to dashboard>plugins>add new
You will see bbPress part of the featured plugins then install and activate.
You can also type 『bbpress』 into the search bar , and that should lead you to the latest version then install and activate from there.
 
2. Set up some test forums
Go into Dashboard>forums>add new
Add a forum and name it whatever you want, but you need at least one to get the forum page going (you can always delete it later).
Now go into the dashboard>topics and create a new topic.  Again you can trash this later, but you』ll want to see what one looks like.
Okay, so now we have bbPress with one forum and one topic, but we』ll need to show it somewhere,  so go to 3 below.
2. Alternative  –  Import a forum !
If you』re planning on migrating from a different forum and would like to use bbPress but keep all of your original forum data, then you will need to import your existing forum data into bbPress.
To import forums go to Dashboard > Tools > Forums and go to the tab 「import forums」
If you need anymore help during this importing process there is a guide that will help you here.
https://codex.bbpress.org/document/
 
3. Creating a forum page
Now we have some forums, we need to have somewhere to display them.
There are two ways to do this. Most themes support method 1, and this can (can not will) produce tighter theme integration on style . However Method 2 allows you to have some introductory words. Your choice…!
Method 1
This requires a couple of checks first
a. In Dashboard>settings>forums look for what is set in the forum root under the forum root slug heading. The default is 『forums』 but you can set this to anything
b. In Dashboard>settings>permalinks check that the common settings check is set to 『postname』 If it isn』t and you don』t want to change it, then use method 2.
Now just create a wordpress page that has the heading that was found in a. above eg if the root slug is 『forums』 create a page with the title 『forums』, and save.
Once the permalink has been created, you can rename the page to whatever you wish eg 『mysite forums』 (as the permalink will stay the same, and it is this permalink that bbpress looks for)
Save this page, add it to a menu if you are using custom menus, or decide its order if you have automatic menus. Then publish it to your site.
Job done!
Method 2
If either your theme doesn』t work with method 1, you don』t want permalinks with postname, or you want to use some introductory text (eg 「welcome to our forums…」, then method 2 is for you.
In dashboard>pages
go to add new page
Call this 『Forums』 or whatever you want your menu item to be.
Then in the content section, you may want to have some introductory words 「welcome to the forum」 etc. then add the following bbpress shortcode
[bbp-forum-index]
Save this page, add it to a menu if you are using custom menus, or decide its order if you have automatic menus. Then publish it to your site.
You will now have a forum page, and a forum to display.
 

4. Amending any other settings
There are several parameters which you can set to get bbPress working as you want it.
These are accessed via Dashboard>Settings>forums
See  https://codex.bbpress.org/document/configuring-bbpress/forum-settings/  for further details.
 
5. Forum Visibility and access
You can use a combination of forum visibility and registration to set up who can :
see your forums
post in your forums
Forum visibility:
Public – Anyone can see these forums
Private – Only logged in registered users with a forum role  can see these forums
Hidden: Only Moderators/keymasters can see these forums
Visibility is set for each forum, go into Dashboard>forums> and when you add/edit a forum, you will see visibility options on the right hand side in the forum attributes.
Users then have a forum role which can be
spectator
particiapant
moderator
keymaster
blocked
 
Forum access
You can set whether users need to be registered and control the registration process.
These two controls give you various degrees of control
Public viewing, public posting
By default forums are available to be publically viewed.  If you set anonymous posting to be on (see 4. Above) then anyone can also post.  This is the most public version of the forum.  It can lead to lots of spam being posted, and does hand control of what』s said in your forums to the internet community, with you effectively being able to only delete afterwards.
Public viewing, registered user posting
Here anyone can view the forums, but only registered users can join in and post.  Registration can be automatic or manual – see 6. below
private viewing, registered user posting
Here you have a private forum. Only registered users can view and post.  Here it would be very unusual to allow automatic registration, and this will be typically a manual process.  To set a forum as private go into dashboard>forums and select edit for the forum you wish to be hidden.  Under the forum attributes on the right hand side, set visibility to private.
 
6. Automatic vs manual registration
If you do not permit anonymous posting, then your users will need to register with your site. It is up to you to decide which method is preferable.
Automatic registration is easier and it does allow people to quickly sign up, but by the same token gives you less control over who is contributing to your forums, and can lead to spam postings.
Manual signup involves you in more administration, but does give you complete control over who has write access.
Neither is better overall, but one will be better for you !
To allow automatic registration, go to Dashboard > Settings > General settings and under membership, tick 「anyone can register」.  Then in Dashboard > settings > forums tick the auto role, and ensure this is only at participant level.
To set manual registration, go to Dashboard > Settings > General settings and under membership, and ensure  「anyone can register」 is not ticked.  Then in Dashboard>settings>forums tick the auto role, and ensure this is only at participant level.
In both cases, you will then need a screen for users to register – we』ll come back to where to put this screen later, but for the moment go into dashboard>pages>add new page and create a page.  You can call this page anything you like but 「register」 or 「registration」 would be logical when users view or access its URL.
If you are doing automatic registration, then put whatever preamble you』d like (「to register for our forums」 etc.) , and then add the following shortcode  [bbp-register].  Save the page.
If you opt for manual registration, then you』ll either need to get your users to email you, or set up a contact form for them to use.
To get you going quickly, maybe just set the page to have you preamble followed by an email link such as
email us your details here
Remember to write this in the 「text」 tab of the content, so that the html is understood.
There are lots of contact form plugins, which you can use later to get a registration form going on this screen.  By all means set this up now, but a placeholder email will get you enough to see how it works.
So now we have a page where our users can register.
 
7. Manually adding forum users to your site and editing them.
If you have opted for manual registration (and it』s what  I do), then when you receive either a contact form or email as set up in 6 above, you』ll need to add each user.
Go into Dashboard>users>add user
Enter their details as required.  You can use the 「send email」 to automatically send them their details from within your site, or you can email external to the site afterwards using your favourite software.  I use an email template within outlook as I can then send 「joining instructions」  and 「forum rules」 as part of the signup.
You』ll not see any bbPress forum related user options/settings at this stage.
If you want to set/amend access level – say to make a user a moderator, then you』ll need to create the user first, and then go back into edit, and now you』ll see an option at the bottom of the amend screen to allow you to change access levels.
Manually adding users also allow you to take away the 「toolbar」 , which I feel always draws away from the look and feel of the site.  We』ll give profile access later in this setup, so it』s not needed.
WHERE HAVE WE GOT TO?
So we now have a forum (or two) on a page which is accessible from the menu.  We』ve decided if any/all forums will be hidden, and who and when people can contribute.  We』ve set up a registration process (albeit the manual one might be a bit basic).
However we』ve not given anyone a place to logon, or indeed register, or anywhere where they can see the latest posts.
You can do this by adding these into a sidebar, or if you are using a full-width page, but adding them to a menu.
But first you need to see if you need to change what page template bbPress is using for your site.
 
8. Make sure bbPress uses the page template we want
So you may want bbpress to display differently than the template it chooses for instance you might want your forum on a full width page and find that it uses a sidebar template, or visa versa.
If you have some knowledge of editing files then follow this guide to help create a bbpress.php file to use for all your bbPress pages.
https://codex.bbpress.org/theme-compatibility/getting-started-in-modifying-the-main-bbpress-template/
Otherwise a more basic explanation follows :
By default bbPress will use a page template in your theme root folder.
It will look for the existence of several files in the following order, using the first one it finds.
plugin-bbpress.php
bbpress.php
forums.php
forum.php
generic.php
page.php
single.php
index.php
Typically most (but not all) themes have a page.php, so if you do nothing else, chances are that that』s the one it will use.
To get bbpress to use a different template from the one your theme is using just copy that template and rename it bbpress.php within your theme root. This is explained a bit more below.
So you may want bbpress to display differently than the template it chooses for instance you might want your forum on a full width page and find that it uses a sidebar template, or visa versa.
You can even find that bbPress appears differently when displaying the forum index than it does with topics, which is probably not what you want. Nowadays theme developers will quite often use 「if…」 code within the page template to change the display of types of pages. Since topics share the same characteristics as posts, but the index page is more like an 「about」 page, the theme can believe that it should show then in different ways.
If bbPress is using the page layouts you want, then that』s fine, and you can ignore the rest of this section.
If not, then the following will let you set bbPress up in the way you want.
You theme will have page templates in the root of the directory, that is :
wp-content/themes/%mytheme%/ where %mytheme% is your theme』s name.
You』ll need to find the name of the page template that you want to use. Look in your theme』s directory – normally they are named very obviously – eg pagefullwidth or pagesidebar. If it』s not obvious, you can see what the template is called by editing a page that has the correct layout, and looking at the name of the template on the right hand side of the edit screen in a panel under the publish/update panel. If you then open the various page.php files, you see that they are named in the first few lines, so you can easily match the name.
So once you know which page template file you need, copy this and rename the copy to bbpress.php
Place this file in the root of your theme ie wp-content/themes/%mytheme%/bbpress.php where %mytheme% is your theme』s name.
bbpress will the use this file for all it』s pages.
If you want to customise the layout for your forums, you can then do this within this file.
 
9. Creating a forum specific sidebar
For most sites, the forum is part of a larger experience, and it is really useful to have a separate sidebar for the forum page that has forum specific widgets on it.
If your forum is all that is on your site, then the default sidebar may be all you need. But If you want to add a sidebar just for your bbPress pages then please follow this tutorial.
Creating a bbpress specific sidebar
 
10. Adding forum menu items
If you don』t use sidebars or footers to display your login and register items, (or even if you do) you』ll probably want to add some menu items.
You can do this quite easily here is how.
First you go to Appearance > Menus.
If you haven』t created a menu for your site , then create one.
You then select the menu you want to edit.
Now you go to the Custom Links section to your left and enter the url of the form you want to lead them to.
So the url of the login form of your site would be
http://yoursite.com/wp-login.php
Where 「http://yoursite.com」 is your sites url.
And the Link Text would be 「Login」.
If you want to put a link to the registration form it would be
http://yoursite.com/wp-login.php?action=register
And the lost password form would be
http://yoursite.com/wp-login.php?action=lostpassword
You can of course use front-end login forms and link to them,
You can also use this plugin to control when to show these menu links to users when they or logged out or haven』t created an account to your site.
https://wordpress.org/plugins/menu-items-visibility-control/
 
AND THAT』S IT !
Now you have a fully functional forum !!!!
Users can register, login, see what forums are available, and contribute.
It may look a little rough at points, this will be clashes between bbPress and your theme, and we』ll start to deal with these in part 2

稽覈和黑名單

稽覈和黑名單

bPress 使用與 WordPress 用於評論的相同的稽覈和黑名單工具。如果您希望使用者的話題和回覆受到額外稽覈,和/或完全禁止釋出,您可以使用評論稽覈和評論黑名單設定,位於:

管理後臺 > 設定 > 討論

當在您的評論稽覈設定中發現包含單詞的話題或回覆時,它將被置於待處理狀態,而不是立即釋出。

當發現某個話題或回覆在您的評論黑名單設定中包含某個詞時,它會被阻止釋出,並且使用者會收到一個相對通用的回覆,例如:

目前無法建立您的話題。

響應保持通用的原因是,冒犯的使用者不會被發現問題,然後他們可以嘗試使用空格、符號或其他 Web voo-doo 來規避。

您目前無法修改這些響應的結果,儘管該 bbp_add_error() 功能的核心補丁可以在 bbPress 的未來版本中相對輕鬆地啟用它。