Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress 2.0 – Theme Compatibility


  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    A few questions have cropped up already, so lets funnel the discussion here.

    bbPress 2.0 introduces a radical new approach at integrating robust new functionality into existing WordPress themes. If you’re an average user looking for a turn-key forum solution, this works out pretty awesomely – If you’re a talented developer trying to beat your own drum, it’s all probably a little bit confusing.

    Theme Compatibility

    bbPress comes with a child theme of TwentyTen, titled (you guessed it) bbPress – TwentyTen. This theme includes all of the custom bits that bbPress needs to function, broken up into template parts to allow them to be used in several places, like template files, shortcodes, and widgets.

    1. MOST COMMON – If you’re using any other conventional WordPress theme (TwentyEleven, BP-Default) and find the default template layout of bbPress acceptable, you don’t need to do anything at all – it should just work.
    2. DO NOT put any custom themes in “/bbpress/bbp-themes/” as they will get wiped out when you update bbPress.
    3. CUSTOM – If you want to build your own theme or make changes to the existing template files, you’ll need to do the following:

      Copy Files

      • If this is not a custom theme under your control (meaning you are not the author) you’ll want to copy the contents of the “/bbpress/bbp-themes/bbp-twentyten” folder into your “wp-content/themes/%YOURTHEMENAME%” folder, where %YOURTHEMENAME% is the name of your custom Child Theme of whatever your current theme is. This is so theme updates don’t wipe out all your hard work later.
      • If you are the author of this theme, then you can copy all the files *out of* the “/bbpress/bbp-themes/bbp-twentyten” folder into the folder of your theme, and make your own edits from there. The files to copy include the single-*, archive-*, page-*, and anything in the subfolders.
      • In neither case should a new folder with the name “bbp-twentyten” exist. You are not copying the FOLDER, you are copying what’s IN the folder.

      Add Theme Support

      Now that you’ve got the files copied over, you’ll need to tell bbPress that you are in control of the theme situation. You do this by adding this to your functions.php file:

      add_theme_support( 'bbpress' );

      By doing this, you’re telling bbPress that your theme has its own template files to handle all of the new functionality that bbPress adds. This method gives you a single on/off switch to either use the standard theme compatibility, or use your own.

    In the future, specialized template compatibility themes can be created either as plugins or child-themes to work like “add on packages” to existing themes, without requiring elaborate edits to existing themes, moving files around, etc…

    Shortcodes (as of May 23, 2011)

    Whether you rely on theme compatibility, or decide to go the custom route, we’ve included a few standard shortcodes to let you output specific forum content on any post or page in your forums. This is accomplished within an output buffer, so they won’t interfere with any of your existing page or post content. Note that if your theme specifically removes the shortcode functionality, these will not work, and will instead the actual text of the shortcode will appear on your site.

    • [bbp-forum-index] – Show the root forums
    • [bbp-single-forum id="A forum ID"] – Show a specific forum
    • [bbp-topic-index] – Show all topics
    • [bbp-single-topic id="A topic ID"] – Show a specific topic
    • [bbp-topic-tags] – Show all topic tags
    • [bbp-topic-tag] – Show topics of a specific tag
    • [bbp-topic-form] – Show the new topic form
    • [bbp-reply-form] – Show the new reply form (not commonly used)
    • [bbp-single-view id="A view slug"] – Show the topics of a registered view

    In the future, we’ll be adding more shortcodes as the needs arise.

    That’s it for the first round of explanations. I’ll edit this post as more questions and answers come through.

Viewing 25 replies - 1 through 25 (of 144 total)
  • Thank you John for this thread.

    I’m currently working on the bbpress-plugin integration for my own themes. One point which is really annoying:

    If I add theme-support for bbpress, the plugin only looks for bbpress-templates inside my theme folder. If i haven’t any template files stored there, no fallback is implemented and therefore nothing is displayed.

    Wouldn’t it be nice, if bbpress looks first on the child-theme for its specific template-files, second at the parent-theme and last takes the builtin template-files from bbpress-twentyten theme?

    The drawback with the currently implementet solution is, that I have to copy every template-file over in my own theme. Regardless of the fact, that I only want to alter one specific template-file. Same goes for a specific css stylesheet.

    I looked at the sourcecode and it seems that i can hook into the filter “bbp_get_theme_compat” and simply de/register a new ‘bbpress-style’ stylesheet. But I think I’m not the only one which is looking for a solution inside bbpress-core.

    If I missed something, do not hesitate to correct me.

    Thanks

    Roman

    Thank you John for this thread.

    I’m currently working on the bbpress-plugin integration for my own themes. One point which is really annoying:

    If I add theme-support for bbpress, the plugin only looks for bbpress-templates inside my theme folder. If i haven’t any template files stored there, no fallback is implemented and therefore nothing is displayed.

    Wouldn’t it be nice, if bbpress looks first on the child-theme for its specific template-files, second at the parent-theme and last takes the builtin template-files from bbpress-twentyten theme?

    The drawback with the currently implementet solution is, that I have to copy every template-file over in my own theme. Regardless of the fact, that I only want to alter one specific template-file. Same goes for a specific css stylesheet.

    I looked at the sourcecode and it seems that i can hook into the filter “bbp_get_theme_compat” and simply de/register a new ‘bbpress-style’ stylesheet. But I think I’m not the only one which is looking for a solution inside bbpress-core.

    If I missed something, do not hesitate to correct me.

    Thanks

    Roman


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    That would be nice, and I’ll most likely research something similar to this after 2.0. The problem is there is no way to add an additional theme path check on top of the parent theme and the child theme locations. Even then, that doesn’t make the single-, archive-, and page- templates match the HTML structure of your current theme, which means manually editing them anyways.

    As annoying as it is to add theme support for bbPress and not have the files there, that’s also the easiest way to communicate ability between theme and plugin. If you add theme support for post thumbnails, and then don’t use post thumbnails in your theme, you just don’t have post thumbnails. :)


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    That would be nice, and I’ll most likely research something similar to this after 2.0. The problem is there is no way to add an additional theme path check on top of the parent theme and the child theme locations. Even then, that doesn’t make the single-, archive-, and page- templates match the HTML structure of your current theme, which means manually editing them anyways.

    As annoying as it is to add theme support for bbPress and not have the files there, that’s also the easiest way to communicate ability between theme and plugin. If you add theme support for post thumbnails, and then don’t use post thumbnails in your theme, you just don’t have post thumbnails. :)


    Tokyorock
    Member

    @tokyorock

    Now i ask the same question here in this thread…

    http://www.tokyorock.net/forums/

    I have done all… but it shows only the forum…but not the theme.. T.T


    Tokyorock
    Member

    @tokyorock

    Now i ask the same question here in this thread…

    http://www.tokyorock.net/forums/

    I have done all… but it shows only the forum…but not the theme.. T.T


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @Tokyorock – Please don’t ask the same questions in multiple places. There aren’t a whole lot of us answering questions yet, so it’s just more work to do. The reason your theme isn’t styled, is because your style.css is empty.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @Tokyorock – Please don’t ask the same questions in multiple places. There aren’t a whole lot of us answering questions yet, so it’s just more work to do. The reason your theme isn’t styled, is because your style.css is empty.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @SHope – You’re okay. :) It sounds like you’re using the shortcodes correctly, but that something else isn’t working. I think I’m going to build in a shortcode helper, because I realize finding the ID isn’t the easiest thing to do.

    On the pages you’re using the shortcodes on, does anything appear where the shortcodes should be?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @SHope – You’re okay. :) It sounds like you’re using the shortcodes correctly, but that something else isn’t working. I think I’m going to build in a shortcode helper, because I realize finding the ID isn’t the easiest thing to do.

    On the pages you’re using the shortcodes on, does anything appear where the shortcodes should be?

    The addition of shortcodes will most certainly make it easier for users to embed the forums as they please and see fit….

    One thing I would like to see though is the addition of a shortcodes icon within the page/post editors for ease of use, this could be extended to allow you to select the specific forum to build a shortcode string.

    When used within a multisite environment it would also lower the amount of confusion as it would most likely also do in single installations. Although shortcodes are simple enough, not everyone is so web savvy.

    Simplicity with a forum shortcode insert button would certainly make it much easier and eye pleasing without to much more code. Please!!!! :-)

    Thanks for all the great work here!

    The addition of shortcodes will most certainly make it easier for users to embed the forums as they please and see fit….

    One thing I would like to see though is the addition of a shortcodes icon within the page/post editors for ease of use, this could be extended to allow you to select the specific forum to build a shortcode string.

    When used within a multisite environment it would also lower the amount of confusion as it would most likely also do in single installations. Although shortcodes are simple enough, not everyone is so web savvy.

    Simplicity with a forum shortcode insert button would certainly make it much easier and eye pleasing without to much more code. Please!!!! :-)

    Thanks for all the great work here!


    Anointed
    Moderator

    @anointed

    Request:

    I am using my own theme and did copy all the files to my themes directory. Everything is working as expected.

    What I would like to do is instead of having to copy all the bbpress theme files into the root of my theme folder, is it possible to simply copy the bbpress folder itself into my theme folder?

    I am finding that I have a ton of files in my theme root level now, and it is a bit ‘messy’. It would be so much cleaner if I could simply keep all my files in the bbpress folder within my themes root folder.

    The problem would only get worse when I add in buddypress custom theme files.

    I am also thinking long-term, as if I come back to a site months down the road, it would make it much easier to remember which template is for which plugin etc.. Having all the bbpress theme files in my theme root is making it hard to remember already what does what.

    What I am hoping for is:

    wp-content/my-theme/bbpress-forum-template-files/

    Is this possible?


    Anointed
    Moderator

    @anointed

    Request:

    I am using my own theme and did copy all the files to my themes directory. Everything is working as expected.

    What I would like to do is instead of having to copy all the bbpress theme files into the root of my theme folder, is it possible to simply copy the bbpress folder itself into my theme folder?

    I am finding that I have a ton of files in my theme root level now, and it is a bit ‘messy’. It would be so much cleaner if I could simply keep all my files in the bbpress folder within my themes root folder.

    The problem would only get worse when I add in buddypress custom theme files.

    I am also thinking long-term, as if I come back to a site months down the road, it would make it much easier to remember which template is for which plugin etc.. Having all the bbpress theme files in my theme root is making it hard to remember already what does what.

    What I am hoping for is:

    wp-content/my-theme/bbpress-forum-template-files/

    Is this possible?


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @anointed – In a word, no. :/ WordPress custom post types only know to look for their files in the root of the theme folder, and the same goes for page templates as well. For now if you want a totally customized theme, those files need to live in the root. I did my best to minimize the number of files in the root, and instead split them up into template parts in the /bbpress folder (because I want the same thing you do.)

    It might be possible to hook into the template loader, see what the request is, and force it to look into a different folder, but there’s no possible way to do it at all with page templates; it’s actually purposely disallowed to prevent the theme from having to scan every file inside every subfolder to find them.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    @anointed – In a word, no. :/ WordPress custom post types only know to look for their files in the root of the theme folder, and the same goes for page templates as well. For now if you want a totally customized theme, those files need to live in the root. I did my best to minimize the number of files in the root, and instead split them up into template parts in the /bbpress folder (because I want the same thing you do.)

    It might be possible to hook into the template loader, see what the request is, and force it to look into a different folder, but there’s no possible way to do it at all with page templates; it’s actually purposely disallowed to prevent the theme from having to scan every file inside every subfolder to find them.


    Anointed
    Moderator

    @anointed

    Thanks for the info, kinda figured that was the case.

    Because I fully plan on using separate template files for each topic, this is going to get out of hand very fast.

    Maybe someday WordPress will look into this a bit more as I can see how this is going to get very messy with very complex themes utilizing a number of template files.

    *I’m sorry that I have not yet participated in posting bugs etc.. I am still quite busy messing with template concepts so I have not yet gotten to the point of even trying out the functionality.


    Anointed
    Moderator

    @anointed

    Thanks for the info, kinda figured that was the case.

    Because I fully plan on using separate template files for each topic, this is going to get out of hand very fast.

    Maybe someday WordPress will look into this a bit more as I can see how this is going to get very messy with very complex themes utilizing a number of template files.

    *I’m sorry that I have not yet participated in posting bugs etc.. I am still quite busy messing with template concepts so I have not yet gotten to the point of even trying out the functionality.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Rather than having a totally separate template file for each topic, why not run some kind function to check which topic is being served, and then use get_template_part to grab the piece you need from your own custom folder? That would prevent you needing to litter the root of your theme with tons of custom files.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Rather than having a totally separate template file for each topic, why not run some kind function to check which topic is being served, and then use get_template_part to grab the piece you need from your own custom folder? That would prevent you needing to litter the root of your theme with tons of custom files.


    Anointed
    Moderator

    @anointed

    That will probably be the long term solution I will use. However, at the moment with bbpress changing so fast I want to make as few changes as possible to ‘core’ bbpress files.

    *I’ll ask you later, when I get to that point, what the best function would be in order to do that as efficiently as possible.

    You are working at such a furious pace on bbpress that I have already had to ‘rebuild’ my custom bbpress custom templates over a dozen times.

    For now I am simply taking the logic out of every bbpress template and wrapping it into my own templates on each revision. Having to remember to change core code as well would be to much to keep up with.


    Anointed
    Moderator

    @anointed

    That will probably be the long term solution I will use. However, at the moment with bbpress changing so fast I want to make as few changes as possible to ‘core’ bbpress files.

    *I’ll ask you later, when I get to that point, what the best function would be in order to do that as efficiently as possible.

    You are working at such a furious pace on bbpress that I have already had to ‘rebuild’ my custom bbpress custom templates over a dozen times.

    For now I am simply taking the logic out of every bbpress template and wrapping it into my own templates on each revision. Having to remember to change core code as well would be to much to keep up with.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    There shouldn’t be too many theme changes anymore. I’ve tried to keep as much logic out of the themes as I could, but in some places there’s a compromise between theme logic and hardcoding things into the plugin. If there’s anyplace where that balance is missed, I’m all ears.


    John James Jacoby
    Keymaster

    @johnjamesjacoby

    There shouldn’t be too many theme changes anymore. I’ve tried to keep as much logic out of the themes as I could, but in some places there’s a compromise between theme logic and hardcoding things into the plugin. If there’s anyplace where that balance is missed, I’m all ears.

    John,

    Question (not advance user so this might not be the smartest question) –

    I have a standard wordpress install (just added bbpress) and using a child theme, based on what you wrote above (focusing on option 2), which files and/or folders should I copy into which folder?

    bbp-twentyten into themes?

    some files into my current child theme?

    Another option?

    Thanks in advanced and keep up the amazing work.

    Kalman

Viewing 25 replies - 1 through 25 (of 144 total)

The topic ‘bbPress 2.0 – Theme Compatibility’ is closed to new replies.