Hello
After experimenting with all your suggestions I think I would like to use the code from
https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/ #11.This redirects both logged in and not logged in users to specific pages which is what I want.
This works partially – I am trying to attach it to my second menu – not the primary menu but whathever I try it doesn’t work. If I leave the code as it is, it displays the links on both menus. I tried to use
if ($args->theme_location == 'sub-header-menu')
in various places such as:
if(is_bbpress() && $args->theme_location == 'sub-header-menu')
I would need this for both logged in and not logged in users.
Thank you very much for your patience. I hope you can help.
It is just a conflicting piece of javascript somewhere in the file. If they already have a fix somewhere in that file for comment threading then something similar may need to be done to bbPress reply threading since both their scripts are very similar.
Try this custom php code snippet. Place it in your child themes functions.php file or in a functionality plugin.
add_action( 'wp_print_scripts', 'rkk_reply_threading_divi' );
function rkk_reply_threading_divi() {
if( function_exists( 'is_bbpress' ) && bbp_is_single_topic() && bbp_thread_replies() ) {
wp_dequeue_script( 'divi-custom-script' );
}
}
If your theme gets a breadcrumb, then disable Yoast’s one. You may have two breadcrumb:
First ==> WordPress
Second==> BBPress
You do this:
*/
function tempera_breadcrumbs1() {
$temperas= tempera_get_theme_options();
foreach ($temperas as $key => $value) { ${"$key"} = $value ; }
global $post;
$separator = "<i class='icon-angle-right'></i> ";
if( !is_bbpress()){
if (is_page() && !is_front_page() || is_single() || is_category() || is_archive()) {
echo '<div class="breadcrumbs">';
echo '<a href="'.home_url().'"><i class="icon-homebread"></i></a>'.$separator ;
if (is_page()) {
$ancestors = get_post_ancestors($post);
if ($ancestors) {
$ancestors = array_reverse($ancestors);
foreach ($ancestors as $crumb) {
echo '<a href="'.get_permalink($crumb).'">'.get_the_title($crumb).$separator.'</a>';
}
}
}
if (is_single()) {
if (has_category()) {
$category = get_the_category();
echo '<a href="'.get_category_link($category[0]->cat_ID).'">'.$category[0]->cat_name.$separator.'</a>';
}
}
if (is_category()) {
$category = get_the_category();
echo ''.$category[0]->cat_name.'';
}
if (is_tag()) {
echo ''.__('Tag','tempera').''.$separator.single_tag_title('', false);
}
// Current page
if (is_page() || is_single()) {
echo ''.get_the_title().'';
}
echo '</div>';
}
elseif (is_home() && $tempera_frontpage!="Enable" ) {
// Front page
echo '<div class="breadcrumbs">';
echo '<a href="'.home_url().'"><i class="icon-homebread"></i></a> '.$separator;
_e('Home Page','tempera');
echo '</div>';
}
}
} // tempera_breadcrumbs()
add_action('after_setup_theme','remove_fonction_parent2');
function remove_fonction_parent2() {
remove_action('cryout_before_content_hook','tempera_breadcrumbs');
add_action ('cryout_before_content_hook','tempera_breadcrumbs1');
}
/*
You have to change the information about your theme.
I use to have a good custom function on my theme that add custom banners before articles, what I do is to write a function with the rotation ads inside.
The final lines are like this:
return $custom_adsense . $content;
}
add_filter(‘the_content’, ‘custom_banner’);
What is the_content equivalent in bbPress?
How can I add a custom banner over all topics?
My theme is Twenty Fourteen and I have a nice space above these forum pages that fits ads perfectly.
@juggledad
@robkk: Just to clarify something, the OR function_exists(‘is_bbpress’) was added (with some other code, to get around a bug that bbpress doesn’t seem to want to acknowledge or fix. see https://bbpress.trac.wordpress.org/ticket/2723
Thanks for pointing that out, i did not know about that bug.
Okay with this bug in bbPress you cannot use the WP conditional is_single()
to affect all of the bbPress pages, since for some reason there is a bug for single user pages.Thanks for creating the trac ticket, I tested out and see that yes it does not work on user pages. Over the next few days/week i will check it out and see I can come up with a fix.
But this bug is easily avoidable by creating a bbpress.php for your theme and just using the_content()
instead of bfa_post_bodycopy()
and removing OR function_exists('is_bbpress')
from the bfa_post_bodycopy()
function. The bbpress.php file also helps remove other post meta that might not be useful for bbPress forums instead of using CSS to hide them.
The OR function_exists('is_bbpress')
you can keep in bfa_get_options.php though as i do not see any problems with that.
If there is something you can find on your end to fix the issue with your theme and bbPress then please drop an answer on this topic, because i haven’t looked and learned your theme 100% yet. Removing the function exists and creating a bbpress.php is the quickest solution to the problem that I could find.
@kitfreeman
This excerpt issue that you are seeing affects all of these areas
category pages
tag pages
author pages
archive pages
search result pages
and the home page
which is where all the excerpt theme settings modify.
@robkk: Just to clarify something, the OR function_exists('is_bbpress')
was added (with some other code, to get around a bug that bbpress doesn’t seem to want to acknowledge or fix. see https://bbpress.trac.wordpress.org/ticket/2723
ok thanks for reminding me …again.
i have been losing track on these topics lately.
What i found is that this bug is because of your theme and not really bbPress. So i recommend contacting your theme developers about this especially since they want to support bbPress.
in the bfa_post_parts.php
file in your functions folder, under the bfa_post_bodycopy
function you will see
OR function_exists('is_bbpress')
This is what is causing your issue.
the way i figured out to fix it is to remove this and create my own bbpress.php off of the index.php file from your theme.
this is all the code i used to create the file. So you can copy and paste this into your theme into a bbpress.php file and all should work …hopefully.
I also left the widget areas there if you want them still there user theme/replace them or just remove them.
<?php
list($bfa_ata, $cols, $left_col, $left_col2, $right_col, $right_col2, $bfa_ata['h_blogtitle'], $bfa_ata['h_posttitle']) = bfa_get_options();
get_header();
extract($bfa_ata);
global $bfa_ata_postcount;
?>
<?php /* If there are any posts: */
if (have_posts()) : /* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?>
<?php if ($bfa_ata['widget_center_top'] <> '') {
echo bfa_parse_widget_areas($bfa_ata['widget_center_top']);
} ?>
<?php while (have_posts()) : the_post();?>
<?php /* Post Container starts here */
if ( function_exists('post_class') ) { ?>
<div <?php if ( is_page() ) { post_class('post'); } else { post_class(); } ?> id="post-<?php the_ID(); ?>">
<?php } else { ?>
<div class="<?php echo ( is_page() ? 'page ' : '' ) . 'post" id="post-'; the_ID(); ?>">
<?php } ?>
<?php bfa_post_headline('<div class="post-headline">','</div>'); ?>
<div class="post-bodycopy clearfix"><?php the_content(); ?></div>
</div><!-- / Post -->
<?php endwhile; ?>
<?php if ($bfa_ata['widget_center_bottom'] <> '') {
echo bfa_parse_widget_areas($bfa_ata['widget_center_bottom']);
} ?>
<?php endif; /* END of: If there are no posts */ ?>
<?php get_footer(); ?>
@mentions is not part of bbPress yet.
but for now you can use the @mentions feature from BuddyPress and use on forums with this code.
copy this into your child themes functions.php or use a functionality plugin.
function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) {
if ( function_exists( 'bbpress' ) && is_bbpress() ) {
$retval = true;
}
return $retval;
}
add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );
and i think you would get an email notification from BuddyPress anytime you get @mentioned
for multiple users you can just separate it with a space.
bbPress i think will have @mentions in a future release, but for now you can use BuddPress’s own scripts for bbPress using this function.
add it to your child theme functions.php or a functionality plugin
function custom_bbpress_maybe_load_mentions_scripts( $retval = false ) {
if ( function_exists( 'bbpress' ) && is_bbpress() ) {
$retval = true;
}
return $retval;
}
add_filter( 'bp_activity_maybe_load_mentions_scripts', 'custom_bbpress_maybe_load_mentions_scripts' );
ok, if you can’t get the right sidebars to show, just have one sidebar and use widget logic to decide what widgets show in which pages
https://wordpress.org/plugins/widget-logic/
then for each widget there is a widget logic box
put
is_bbpress() if you want that wiodget to appear in forums
!is_bbpress if you want it to appear in pages other than forums
and leave blank for both
ok, try
https://wordpress.org/plugins/widget-logic/
use
is_bbpress()
where you want a widget displayed on bbpress pages and
!is_bbpress()
where you don’t
ok install widget logic
https://wordpress.org/plugins/widget-logic/
this adds a box to each widget in a sidebar
so work out which sidebar is showing in your bbpress pages and for each widget in that sidebar into that box put
is_bbpress() if you want it to appear in forum pages
!is_bbpres() is you don’t want it to appear in forum pages (but do want it on other pages where that sidebar appears
and leave blank if you want tit to appear on both forum and other pages
the try widget logic
Download “widget logic”
https://wordpress.org/plugins/widget-logic/
This plugin lets you specify conditions for when widget items are displayed.
You would then put all the widgets for both the blog page and the forum page in one sidebar
Against each of these you then specify whether you want it to appear on the forum page, on any page with a sidebar that is not the forum (eg your blog), or on both forum and other sidebar pages.
you do this by putting the following code in the widget logic box that you will see appears against each widget
For a forum sidebar you put : is_bbpress() ie is this page a forum page
For any other sidebar you put : !is_bbpress() ie is this page NOT a forum page
For any item to appear on both, simply leave the logic blank.
Give that a try and come back and let us know how it works
ok, it’s your theme that’s causing the issue, some theme authors are too clever with their coding, and bbpress uses a category of archive, hence why it is displaying this sidebar. Also I suspect the theme won’t be allowing dynamic sidebars, hence why tweaks isn’t working.
So onto plan b !
install a plugin called ‘widget logic’
https://wordpress.org/plugins/widget-logic/
Then against each widget in your archive/post/search sidebar, you’ll see an extra field called widget logic
If you want that widget only in bbpress forums put
is_bbpress()
in to that line
if you don’t want that widget in bbpress, but do want it in other pages that use the archive/post/search sidebar the put
!is_bbpress()
in the widget logic area
If you want in both, then leave widget logic blank.
Line 65 is:
if( is_page() || is_bbpress() ) {
function travelify_theloop() {
if( is_page() || is_bbpress() ) {
if( is_page_template( 'templates/template-blog-large-image.php' ) ) {
travelify_theloop_for_template_blog_image_large();
}
elseif( is_page_template( 'templates/template-blog-medium-image.php' ) ) {
travelify_theloop_for_template_blog_image_medium();
}
elseif( is_page_template( 'templates/template-blog-full-content.php' ) ) {
travelify_theloop_for_template_blog_full_content();
}
else {
travelify_theloop_for_page();
}
}
Hi, i have a wired problem.
When i have bbpress activate, my page works fine.
but when i deactivate the bbpress plugin, my mainpage stop working,
and i get a php error in logs
[10-Feb-2015 10:47:43 UTC] PHP Fatal error: Call to undefined function is_bbpress() in /var/www/clients/client3/web3/web/wp-content/themes/travelify/library/structure/content-extensions.php on line 65
ok, the following code removes the edit for bbpress, but leaves it for normal wordpress pages
function wpse_remove_edit_post_link( $link ) {
if (is_bbpress()) return '' ;
else return $link ;
}
add_filter('edit_post_link', 'wpse_remove_edit_post_link');
The users will still be able to edit their topics and replies via the in-box edit buttons
After installing BBPress nothing was working, I could see a list of forums if I went to /forums/ but nothing appeared to create a new forum or post, and no form appeared to enter a reply. I rebuilt the pages using the shortcodes and this worked great, but if I click “Edit” on a reply I get a page with no content.
Here is the code I am using in my main template to make the BBPress items show up:
<?php if (is_bbpress()) : ?>
<section id="content" class="grid-block"><h3 class="page-subtitle"><?php echo $this['config']->get('Subtitle'); ?></h3>
<?php
if(!is_user_logged_in())
{
echo do_shortcode("[bbp-login]");
} else {
echo 'bbpress page';
$forum_id = get_the_ID();
if( get_post_type( $forum_id ) == 'page')
{
echo do_shortcode("[bbp-forum-index]");
}
echo do_shortcode("[bbp-single-forum id=" . $forum_id . "]");
echo do_shortcode("[bbp-single-topic id=" . $forum_id . "]");
}
?>
I can’t find a shortcode for the reply edit form. How can I made the reply edit form appear on a page?
Also none of the forms worked until I added this to the functions.php:
add_filter( 'bbp_verify_nonce_request_url', 'my_bbp_verify_nonce_request_url', 999, 1 );
function my_bbp_verify_nonce_request_url( $requested_url )
{
return 'http://localhost:8088/mySite/' . $_SERVER['REQUEST_URI'];
}
I am using a woo-theme with their warp system, I think it does not work well with bbpress.
Please, how can I made the edit form appear? There appears to be no shortcode for that.
Try the following
//adds login/logout to menu
//filter to add login/logout to menu
add_filter( 'wp_nav_menu_items', 'my_nav_menu_login_link' );
function my_nav_menu_login_link($menu) {
//uncomment the next line if you only want login on bbpress pages
//if(is_bbpress()) {
if (is_user_logged_in()) {
//set the $url on the next line to the page you want users to go back to when they logout
$url = 'http://www.mysite.com/forums' ;
$url2=wp_logout_url($url) ;
$loginlink = '<li><a title="Logout" href="'.$url2.'">Logout</a></li>';
}
else {
$current_user = wp_get_current_user();
$user=$current_user->user_login ;
//set $page on the next line = the permalink for your login page
$page='login' ;
$loginlink = '<li><a href="/'.$page.'/">Login</a></li>';
}
//uncomment out the next lines if you only want login on bbpress pages
// }
// else {
// $loginlink="" ;
// }
$menu = $menu . $loginlink;
return $menu;
}
Disregard, I atleast have it figured out for now. I copied the theme-styles.php file to the child theme and then searched for;
if ( is_page_template('page-landing.php') || is_page_template('page-alt-home.php') ) {
$layout = "Full-Width";
global $solostream_options;
$solostream_options['solostream_layout'] = $layout;
and added the following right below it…
if ( is_bbpress() ) {
$layout = "Full-Width";
global $solostream_options;
$solostream_options['solostream_layout'] = $layout;
}
Still not completely sure why this is happening, but I think it’s because of the way the forum is being displayed using the BuddyPress group tabs/screen hooks. Digging into the is_bbpress() function, none of the WP_Query information is being set so it doesn’t pass any of the is_ functions.
You can filter is_bbpress in bbpress > includes > extend > buddypress > groups in the setup_filters() function and get it working, but I can’t see a way of doing this without modifying the plugin code.
Hi guys,
I was battling with this issue too. I didn’t want to abandon the Yoast SEO plugin so this is the function I added to functions.php in my WordPress theme to fix the issue:
// fix yoast seo plugin issue with user title
function fix_not_found_title($title){
if (is_bbpress()){
if ($title == ‘Page Not Found – SiteNameHere’){
return ‘Forum User: ‘.bbp_get_displayed_user_field( ‘display_name’ );
} else {
return $title;
}
} else {
return $title;
}
}
add_action( ‘wpseo_title’, ‘fix_not_found_title’ );
It’s a bit of a hack but it works for now. I hope that helps!
Cheers,
Sebastian
I’m using the following in my theme’s functions.php, although for some reason is_bbpress() isn’t working on Buddypress Group Forums for me.
if( ! function_exists( 'my_dequeue_bbp_scripts' ) )
{
function my_dequeue_bbp_scripts()
{
if( function_exists( 'is_bbpress' ) )
{
if( ! is_bbpress() )
{
wp_dequeue_style('bbp-default');
wp_dequeue_style('bbp-default-rtl');
}
}
}
}
if( ! is_admin() ) add_action( 'wp_enqueue_scripts', 'my_dequeue_bbp_scripts' );
Using WordPress 3.9.2, bbPress 2.5.4 and BuddyPress 2.0.2. Site is password protected I’m afraid. It is using a custom theme, based on Responsive.
is_bbpress() is returning false on any bbpress pages that fall under a BuddyPress group. If this seems to be custom theme related are there any tips for debugging?
I just used this code, to no avail. It causes an error on the site – check it out.
<?php
get_header(); // Loads the header.php template. ?>
<?php if ( is_bbpress() ) { ?>
<header class="entry-header">
<h1 class="entry-title"><?php single_post_title(); ?></h1>
<?php echo apply_atomic_shortcode( 'entry_byline', '<div class="entry-byline">' . __( 'Published by [entry-author] on [entry-published] [entry-comments-link before=" | "] [entry-edit-link before=" | "]', 'spine2' ) . '</div>' ); ?>
</header><!-- .entry-header -->
<?php while( have_posts() ): the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<footer class="entry-footer">
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms before="Posted in " taxonomy="category"] [entry-terms before="| Tagged "]', 'spine2' ) . '</div>' ); ?>
</footer><!-- .entry-footer -->
<?php } else { ?>
<div id="content" class="hfeed">
<?php get_template_part( 'loop-meta' ); // Loads the loop-meta.php template. ?>
<?php get_template_part( 'loop' ); // Loads the loop.php template. ?>
<?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
</div><!-- #content -->
<?php get_footer(); // Loads the footer.php template. ?>