Jump to content
Sign in to follow this  
winprogger

Controlling layout of bbpress page

Recommended Posts

winprogger

I have bbpress deep integrated with wordpress (PlatformPro) but how do I control the page layout of the bbpress main page ? I need to hide some of the sections.

Share this post


Link to post
Share on other sites
Andrew

Hmm... well it isn't as easy as in WordPress. We shoul

Share this post


Link to post
Share on other sites
winprogger

Andrew it seems your reply was cut off.

Share this post


Link to post
Share on other sites
Andrew

Ya I lost internet :) Anyway, we could add some functionality for this to the theme; I don't believe it is easy ..yet.. What do you need to hide?

Share this post


Link to post
Share on other sites
winprogger

For starters I needed to hide the morefoot side bars, the twitter bar and the pagelines image to the right. I need to add some stuff as well. It would have been nice if the theme settings for forum had given me control over the layout of the forum page. Or there was a way to embed forum content in a regular wordpress page.

Share this post


Link to post
Share on other sites
bryan-hadaway

Cool, let's get a link to your forum and I can help you hide what you need to hide. Thanks, Bryan

Share this post


Link to post
Share on other sites
cmunns

At this point it's difficult because there are no unique page IDs nor is there a place to enter meta data for bbpress pages. I know Automattic is working right now on creating bbPress as a plugin of WP and extending the functionality which should make things easier. To solve this particular problem you would have to append a class to bbPress pages using a conditional statement and a WP hook. The idea is similar to this: http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/ but you would use a `if (bb_forums()){}` instead. THen you can use the CSS to hide the page elements.

Share this post


Link to post
Share on other sites
winprogger

@Adam - The first time I saw your response, I was like what in the... Now that I see you have more faith in me than I do, I have a question that should impress - does add_filter for body_class go in functions.php ? Let's say I succeed at this in hiding sections I do not want, how would i add stuff to that page ? Thanks for the Automattic pointer. I could not find any link regarding that effort however. What would we be able to do with the plugin ? Do you know if it is imminent ?

Share this post


Link to post
Share on other sites
cmunns
Now that I see you have more faith in me than I do, I have a question that should impress - does add_filter for body_class go in functions.php ?
-yes adding stuff would also require hooks, it's a tough road either way.

Share this post


Link to post
Share on other sites
winprogger

I tried the following -

	
	//this is our filter hook to introduce a class on the body //when the body is being rendered in bbpress
	
	add_filter('body_class', 'browser_body_class');
	
	function browser_body_class($classes)
	{
	     if(bb_forums())
		$classes[] = 'wpforums';
	     return $classes;
	}
	
	

I get a syntax error on call to bb_forums. what did I miss ?

Share this post


Link to post
Share on other sites
bryan-hadaway

Marking for further developer review. Thanks, Bryan

Share this post


Link to post
Share on other sites
winprogger

I am still getting

Call to undefined function bb_forums() in <path>functions.php on line <lineno>

Share this post


Link to post
Share on other sites
alexqw

I would like to add my vote for this kind of control. From what I've last read, an alpha of bbpress plugin is supposed to be available sometime this month. Having this available as a plugin should make it easier to control and customize. You can follow the progress of bbpress plugin in the bbpress forums. ---Alex

Share this post


Link to post
Share on other sites
bryan-hadaway

For now you could simple edit the forum theme header.php and add a class to ``... `` Then you could style it up all you wanted from WordPress/Theme: Custom Code > Custom CSS. Thanks, Bryan

Share this post


Link to post
Share on other sites
winprogger

Switching to

bb_forum
instread of
bb_forums
leads to the same results
Undefined function bb_forum
etc etc. I am touching platformbase
function.php

. Please advise.

Share this post


Link to post
Share on other sites
winprogger

@Bryan - Looking at the theme's

header.php
file gave me a different idea. Perhaps it should be global instead of a function call (as it is in
header.php
). So if I switch from
bb_forum()
to
$bbpress_forum
, the error does not happen but the class is not added. Here is how it looks now
//this is our filter hook to introduce a class on when the //body is being rendered in bbpress
	add_filter('body_class', 'browser_body_class');
	
	function browser_body_class($classes)
	{
	    global $bbpress_forum;
	    if($bbpress_forum)
	       $classes[] = 'wpforums';
	    return $classes;
	}

Share this post


Link to post
Share on other sites
winprogger

Sorry for not following up on this. In bb-templates/PlatformForum/header.php i do not see a body tag getting emitted directly. Is that buried deep in some other php file ?

Share this post


Link to post
Share on other sites
cmunns

I've recently had to do this myself and it appears my suggestions aren't working as they should anyway and adding hooks via the Base child theme doesn't seem to work even when using bbPress conditional tags. Fortunately I do believe Automattic is hard at work improving bbPress so it integrates with WP as a plugin. Believe me when I say I can't wait for that!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×