Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbPress INCLUDE in template


  • Steven Hodson
    Participant

    @stevenhodson

    is there the ability to use the WP type INCLUDE in bbPress in order to include an custom php file? What I want to do is take the repeating “sidebar” code into a separate file so I don’t have to update all the files that include the sidebar code

Viewing 5 replies - 1 through 5 (of 5 total)
  • bbPress does not have a built in “get_sidebar” function like WP but you can use a regular PHP include.

    include ‘sidebar.php';

    I’ve opted to include my sidebar within my footer template but I can imagine that might not always be doable with a more complex layout.


    Steven Hodson
    Participant

    @stevenhodson

    @Taeo Ya I realize that bbPress doesn’t have the same sidebar ‘functionality’ as WordPress. What I’mm looking for is more of hte code re-use idea .. write one (or two) sidebars.php and then just include them so thanks on the PHP confirm – I am pretty much a PHP n00b …..


    chrishajer
    Participant

    @chrishajer

    Steven, here is the exact way to do it if you still need help:

    <?php include("/www/yoursite/forum/my-templates/your-template/sidebar.php");?>

    Then the file you are including just goes in sidebar.php in your template folder. Write the sidebar once, use it anywhere.


    Ben L.
    Member

    @nightgunner5

    Or, if you want to follow coding standards, <?php bb_load_template( 'sidebar.php' ); ?>.


    Steven Hodson
    Participant

    @stevenhodson

    @bEn L .. thank you very much .. we really need a codex with bbPress template tags

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.