Skip to:

Opened 7 years ago

Closed 6 years ago

#2723 closed defect (bug) (duplicate)

is_single() does not work on bbpress user pages

Reported by: juggledad Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.4
Component: General Keywords:
Cc: juggledad@…


The WordPress conditional is_single() does not work when you are on a bbpress user page even though the class 'single' is part of the <body...> element.

to recreate this issue using twenty-thirteen
1) create a new WP site
2) activate twenty-thirteen
3) install bbpress (using v2.5.4)
4) add a forum
5) add a message to the forum

6) edit the twenty-thirteen style,css and add the following just before the table of contents

body.single #page {background: tan !important;}
body.home #page {background: pink !important;}

this will be used to identify via CSS the page type
7) edit the twenty-thirteen template 'page.php' and change the following line

		<div id="content" class="site-content" role="main">


		<div id="content" class="site-content" role="main">
<?php echo '<br>pp is_single='.is_single().'<br>'; ?>
<?php echo 'pp is_page='. is_page().'<br>'; ?>
<?php echo 'pp is_archive='. is_archive().'<br>'; ?>
<?php echo 'pp is_author='. is_author().'<br>'; ?>
<?php echo 'pp is_post_type_archive ='. is_post_type_archive().'<br>'; ?>
<?php echo 'pp is_category ='. is_category().'<br>'; ?>
<?php echo 'pp is_tag ='. is_tag().'<br>'; ?>
<?php echo 'pp is_tax ='. is_tax().'<br>'; ?>
<?php echo 'pp post_type='.get_post_type( $post ).'<br>'; ?>

this will display the conditional page.
8) go to the home page

  • - > you will see the page background is pink

9) go to your

  • - > you will see that is_archive = 1

10) select a forum

  • - > you will see the background is tan because of the css
  • - > is_single=1 and
  • - > post_type=forum

11) select a topic

  • - > you will see the background is tan because of the css
  • - > is_single=1 and
  • - > post_type=topic

now the problem

12) select the topic author (probably ;admin' if using all the defaults)

  • - > you will see the background is tan because of the css
  • - > all conditions show nothing

so even though the <body...> has a class of single, the is_single() is saying it is not a single. This is a bug since the plugin should honor the wordpress conditionals. Note that all the links under the author (profile, Topics Started etc) are also ignoring the is_single.

Change History (4)

#1 @juggledad
7 years ago

  • Cc juggledad@… added

#2 @netweb
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

bbPress uses it's own conditions, a full list of them is here

You might also find this useful for conditionsals along with the bbPress/BuddyPress conditionals

#3 @juggledad
7 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

So you are saying that BBPress -in certain cases - ignores WordPress conditionals and you think that is acceptable??
This means that the display of a site could be messed up because the theme author is not using BBPress conditionals??? That every theme has to add logic to make sure it will test for bbpress conditionals? Really??

seems to me the statement:
bbPress 2.x plugin for WordPress has built-in theme support. All required elements such as front-end editing are included. This means that all functionality will work, even when a theme has no specific bbPress templates or code included with it. To get started customizing bbPress see Theme Compatibility.

means a theme should not have to use a bbpress for it to display properly and this is not currently the case because of this BUG.

Just to point out, this was also an issue with BuddyPress and they acknowledged that there was a bug and have fixed it.

Last edited 7 years ago by juggledad (previous) (diff)

#4 @Robkk
6 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

This is fixed in the latest dev version of bbPress.

This ticket is a duplicate to #2545

Note: See TracTickets for help on using tickets.