Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Add a “page” to my template

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

Skip to toolbar