bbPress

Simple, Fast, Elegant

bbPress support forums » Themes

Add a "page" to my template

(5 posts)
  • Started 1 year ago by blepoxp
  • Latest reply from Ralev-dot-com
  • This topic is not a support question
  1. How would I go about adding a page with static informaiton to my template?

    I have the page 'purchase.php' and want to add it into my template. I thought I would just do an include, but then I realized I have nothing to include into.

    Then I thought I would just get header and get footer around my static info and link directly for it, but then the bb functions are being called correctly.

    What is the best way to include static information in the site in a manner where I can include a link to it?

    Posted 1 year ago #
  2. Hmmm... no replies yet? I have the same question, so I would appreciate a little help... :-)

    Posted 1 year ago #
  3. Hi,
    Here is a quick php for it(Use this method at your own risk), you need pretty permalink to use it.

    Save the following code in bbPress root folder as page.php

    <?php
    require_once('./bb-load.php');
    if (preg_match('/.*\/page\/(.*)/', $_SERVER['REQUEST_URI'], $matches)) {
        $file = bb_slug_sanitize($matches[1]) . '.php';
        if (file_exists(bb_get_active_theme_folder() . "/static/$file")) {
            bb_load_template("static/" . $file);
            exit(0);
            }
        }
    wp_redirect(bb_get_option('uri'));
    ?>

    Put your static pages in a new static folder under your template folder, they should looks like

    <?php bb_get_header(); ?>
    The static content here.
    <?php bb_get_footer(); ?>

    Then you can access a static file. For example, access test.php(bb-templates/yourtemplate/static/test.php) at http://yoursite.com/bbpress/page/test

    Remember: Use this method at your own risk

    Posted 1 year ago #
  4. vafaaaan
    Member

    ...

    Posted 11 months ago #
  5. I'm using this method here: http://desbar.eu/
    check the ABOUT page, for example

    it works for me.

    Keep in mind there are a lot of ways to make a static page.
    1. The most simple is to create some about.php file.
    It should looks like livibetter says:

    <?php bb_get_header(); ?>
    The static content here.
    <?php bb_get_footer(); ?>

    2. put this about.php in the root directory ( e.g. - the URL should be something like youbbPressSite.com/about.php )

    3. Then call this URL from somewhere ( e.g. - put a link in the Header.php )

    that's it.

    PS: I've just been curious about the method above (livibetter version) - that's why I used it :) looks smoother at first site.

    Posted 11 months ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.