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