HOWTO Add Custom Pages to Your WordPress Installation

NOTE: These instructions were written for WordPress version 1.2.2.
There are a number of published ways to add custom pages to your WordPress web site such as the EZStatic plugin. I am simply displaying the solution I came up with.

  • Open your index.php file for editing.
  • Locate <div id="content">
  • Add the following snippet of code below <div id="content">:


<?php
if (isset($_GET['p'])) {
$bt_custom_page = false;
$bt_page = $_GET['p'];
if (
preg_match(
'/^(about|documents|projects|contact)$/i', $bt_page) > 0) {
if ((include 'bt_' . $bt_page . '.inc.php') !== false) {
$bt_custom_page = true;
}
}
}
if (!$bt_custom_page) {
?>

  • Locate <div id="menu"> and notice the </div> just above it.
  • Add the following snippet of code above that </div>:
  • <?php } ?>
  • Now create a new file in the same directory as index.php named bt_about.inc.php containing the following:


<div class="post">
<h3>About</h3>
<p>Write your content here.</p>
</div>

  • Now direct your browser to your WordPress web site and append ?p=about to the address e.g. http://www.yourwebsite.com/index.php?p=about
  • Add links to these custom pages by using the WordPress link manager
  • You can add more custom pages by modifying the list of pages about|documents|projects|contact in the first snippet of code that you added to your index.php file

Please let me know if any of the instructions above are unclear by commenting on this post. I will attempt to clarify any ambiguity.