bbPress 條件標籤

bbPress 條件標籤

參見 WordPress Codex https://codex.wordpress.org/Conditional_Tags

is_bbpress()

/** 檔案 *****************************************************************/

bbp_is_forum_archive()

bbp_is_topic_archive()

/** 話題標籤 **************************************************************/

bbp_is_topic_tag()

bbp_is_topic_tag_edit()

/** 組件 *************************************************************/

bbp_is_single_forum()

bbp_is_single_topic()

bbp_is_single_reply()

bbp_is_topic_edit()

bbp_is_topic_merge()

bbp_is_topic_split()

bbp_is_reply_edit()

bbp_is_reply_move()

bbp_is_view()

/** 用户 ***********************************************************/

bbp_is_single_user_edit()

bbp_is_single_user()

bbp_is_user_home()

bbp_is_user_home_edit()

bbp_is_topics_created()

bbp_is_replies_created()

bbp_is_favorites()

bbp_is_subscriptions()

/** 搜索 ***********************************************************/

bbp_is_search()

bbp_is_search_results()

bbp_get_user_profile_url

bbp_get_user_profile_url

bbp_get_user_profile_url
Codex Home → bbp_get_user_profile_url
Description
The 『bbp_get_user_profile_url』 function returns the URL of the supplied user』s profile.
How to use it

$user_id – The specified user to return the profile link for.
Sample code example

<a href="ID); ?>">Your Forum profile

Creates a link to the current user』s profile.

bbPress 1.x & BuddyPress Group Forums

bbPress 1.x & BuddyPress Group Forums

bbPress 1.x & BuddyPress Group Forums
Codex Home → Getting Started → Importing Data → Import Forums → bbPress 1.x & BuddyPress Group Forums
bbPress 1.x
To import the old bbPress 0.x/1.x standalone forums to bbPress 2.x you must upgrade to bbPress 1.2.
A good starting point on how to this is in the following topic.

Vanilla

Vanilla

Vanilla
Codex Home → Getting Started → Importing Data → Import Forums → Vanilla
Vanilla 2.0.18.1 Importer for bbPress
FAQ & Known Issues
Note: This is for the 『stand alone』 Vannila Forums from vannilaforums.org, if you are trying to import from vanillaforums.com you will have to export your data and then perform a custom import.
Forums

Forum 『Categories』 are imported as a 『Forum』 – You must manually configure the forum types for 『category』 forum type after the import and recounts have finished.
Forum visibility such as moderator or admin only forums will be publicly visible after importing and you need to secure these manually.
『Locked Forums』 will be imported as like a normal open forum, again you can close/lock these via the forums panel in wp-admin and setting the forum attributes status to closed.

Topics & Replies
Announcement and Sticky topics 『topic status』 are not set during import, manually 『stick』 any topics after import and recounts are complete. (See trac ticket #2126)
You may find extra page breaks
and paragraph

elements in topics and replies and is less than ideal and is from the way the BBCodes are converted during the forum import conversion. You will find these primarily around 『blockquotes』 and 『lists』
If you are using bbPress 『Show Lead Topic』 some of the formatting will be broken, it has been converted correctly and is an issue with the content-single-topic-lead.php template, see trac # (Ticket to follow).
elements seem to be a hit and miss at the moment, they render sometimes and sometimes not depending on the import. (not very helpful I know, still digging around this issue)
are not currently enabled to be embedded inline in bbPress by default with topics and replies, everything was converted correctly and we just need to throw some switches and push some buttons before the next release of bbPress to make it work, watch this space.
Not all smilies are converted, only the subset the WordPress has built in.

Users
User 『Favorites』, 『Subscribed Topics』 or 『Personal Messages (PM』s) are not supported or imported.
User 『Avatars』 are also not supported 『out of the box』 by either WordPress or bbPress, if the users email address is registered with a 『Gravatar this will automatically be used by WordPress and bbPress, otherwise this is plugin territory.

References
Notes
Customizing
Via bbpress.org if you are using the Vanilla2 『ReplyTo』 plugin you can add support for threaded replies to youur import via this customized version of the import script.

開始修改主要 bbPress 模板

開始修改主要 bbPress 模板

此頁面的目標受眾是基本熟悉編輯 WordPress 主題模板的人。

如果您只是選擇 bbPress 並且想要對正在呈現的模板進行一些基本更改,例如刪除 WordPress 評論代碼或任何僅應在博客文章中顯示的帖子元,那麼請按照本指南進行操作。

在 bbPress 的普通安裝中,該插件會從您當前活動的 WordPress 主題中查找以下模板,並將論壇 「注入」 到它找到的第一個模板中。

它將找到具有下面列出的名稱的任何頁面模板。

  • plugin-bbpress.php
  • bbpress.php
  • forums.php
  • forum.php
  • generic.php
  • page.php
  • single.php
  • singular.php
  • index.php

對於 WordPress 主題,最常見的是將論壇代碼注入 page.php 文件。要找到確切的文件,請安裝插件 What The File 並轉到您網站的 bbPress 論壇部分並檢查您的 WordPress 工具欄,看看要修改的確切文件是什麼。

然後您可以複製您找到的文件並將其重命名為上面列出的任何文件名,並確保它位於您的主題根目錄中。

wp-content/themes/%mytheme%/bbpress.php 其中 %mytheme% 是您當前活動主題的名稱。

建議使用子主題,以免在下次更新主題時丟失任何更改。

畢竟,您可以自定義新的 bbpress.php 文件以刪除任何不需要的代碼/設計您的 bbPress 論壇,bbPress 插件應該選擇該模板並使用該自定義模板呈現其所有頁面。

示例模板

不要只是將此代碼複製並粘貼到空白模板中。所有的主題都不一樣。將其用作指南。

請閲讀代碼中的註釋。

<?php   /* * * The template for displaying all bbPress pages * * This is the template that displays all bbPress pages by default. * Please note that this is the template of all bbPress pages * and that other 'pages' on your WordPress site will use a * different template. * * @package WordPress * @subpackage Theme */     /* Self explanatory its a functions that gets your header template. */   get_header(); ?>     <?php /* Surrounding Classes for the site   These are different every theme and help with structure and layout   These could be SPANs or DIVs and with entirely different classes. */ ?>   <div id="primary" class="site-content">   <div id="content" role="main">     <?php /* Start the Loop */ ?>   <?php while ( have_posts() ) : the_post(); ?>     <?php /* This is the start of the page and also the insertion of the post classes.   Post classes are very handy to style your forums. */ ?>   <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>     <?php /* This is the title wrapped in a header tag   and a class to better style the title for your theme */ ?>   <header class="entry-header">   <h1 class="entry-title"><?php the_title(); ?></h1>   </header>     <?php /* This is the content wrapped in a div   and class to better style the content */ ?>   <div class="entry-content"> <?php the_content(); ?> </div>   <!-- .entry-content -->     <?php /* End of Page */ ?>   </article>   <!-- #post --> <?php endwhile; // end of the loop. ?>   </div>   <!-- #content -->   </div>   <!-- #primary -->     <?php /* This is code to display the sidebar and the footer.   Remove the sidebar code to get full-width forums.   This would also need CSS to make it actually full width. */ ?>   <?php get_sidebar(); ?> <?php get_footer(); ?>

為 bbPress 論壇呈現自定義模板代碼的另一種方法是在 PHP if 語句中使用條件標記,例如 is_bbpress() 。

這是一個例子。

<?php if ( is_bbpress() ) : ?>   <div class="abc">   This content should show if it is bbPress       </div>   <?php else : ?>   <div class="xyz">   This should show if it is not bbPress       </div>   <?php endif; ?>

SimplePress

SimplePress

SimplePress
Codex Home → Getting Started → Importing Data → Import Forums → SimplePress
Simple Press v5.x Importer for bbPress
FAQ & Known Issues
Versions
Latest tested version: v5.5.2 – Build 12017
Forums

Forum 『Categories』 are imported as a 『Forum』 – You must manually configure the forum types for 『category』 forum type after the import and recounts have finished.
『Locked Forums』 will be imported as like a normal open forum, again you can close/lock these via the forums panel in wp-admin and setting the forum attributes status to closed.

Topics & Replies

Sticky topics 『topic status』 are not set during import, manually 『stick』 any topics after import and recounts are complete. (See trac ticket #2126)
Custom BBCodes are not supported eg. [youtube] – You will have to manually change these yourself after importing into bbPress using phpMyAdmin.
Smilies are rendered as images if contained in 『code』 tags eg. :)
You may find extra page breaks
and paragraph

elements in topics and replies and is less than ideal and is from the way the BBCodes are converted during the forum import conversion. You will find these primarily around 『blockquotes』 and 『lists』
If you are using bbPress 『Show Lead Topic』 some of the formatting will be broken, it has been converted correctly and is an issue with the content-single-topic-lead.php template, see trac # (Ticket to follow).
elements seem to be a hit and miss at the moment, they render sometimes and sometimes not depending on the import. (not very helpful I know, still digging around this issue)
are not currently enabled to be embedded inline in bbPress by default with topics and replies, everything was converted correctly and we just need to throw some switches and push some buttons before the next release of bbPress to make it work, watch this space.
Topic Tags are not imported as this is a paid extension of SimplePress
File attachments are left as is in the WordPress media library, any posts with attachments the URL』s will have to be manually updated after import.

Users

If you are going to use the same WordPress install for your import you do not need to import the users as they are already in the WordPress wp_users table. If you are setting up a fresh install of WordPress simple check the 『convert users』 option before you start your import.
Any custom SimplePress Moderators or Groups are not converted, any users you wish to make 『moderators』 or 『keymasters』 you will have to assign these roles manually via the main WordPress Admin User panel (/wp-admin/users.php).
User 『Favourites』, 『Subscribed Topics』 or 『Personal Messages (PM』s) are not supported or imported.

References
Notes
Redirecting from your old forum to your new
https://bbpress.org/forums/topic/v2-simple-press-importer-and-first-thoughts/page/2/#post-124953 by @shrewdies