Info
- 3 posts
- 3 voices
- Started 5 years ago by Glenn Ansley
- Latest reply from Ralev-dot-com
- This topic is not a support question
Add a "page" to my template
-
- Posted 5 years ago #
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 4 years ago #
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
staticfolder 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/testRemember: Use this method at your own risk
-
- Posted 4 years ago #
I'm using this method here: http://desbar.eu/
check the ABOUT page, for exampleit 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.
-
You must log in to post.