為什麼要有測試站點?

為什麼要有測試站點?

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

許多 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 的未來版本中相對輕鬆地啓用它。