Move of site

How to Add a Static Page  

Post Categories   Post Time 3 years, 9 months ago

I’ve had a number of requests recently inquring into how it is possible to add a “static” page to your blog. This can be illustrated by clicking on a link above, such as “Software” or “Contact” above. This really isn’t hard to do, and it can benefit your website considerably, by allowing you to have other pages which integrate with your blog. I’ll split it down into steps to make it easy to follow:

  • First, you need to make sure that the various elements of your page are either controlled by a style sheet, or “plugged in” to the pages of your blog through the use of PHP includes. There are various tutorials on the net about how to do this. I recommend having seperate PHP files for your header, navigation and footer.
  • The next part involves you creating the new PHP file for the new page (e.g. contact.php), then copying the top and bottom of your index.php blog file to the new PHP file you just created. You need to copy everything above the following line of code:

    [PHP]< ?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>[/PHP]

    And below this line of code:

    [PHP]< ?php the_content(); ?>[/PHP]

    Into the new file. Please ensure that the following is shown at the top of the file:

    [PHP]< ?php require('./wp-blog-header.php'); ?>[/PHP]

  • Then, it’s simple a case of entering your own content into the contact.php file. You could change the page title, main body content etc. Just insert what you want to appear in standard HTML code.
  • Upload the new file, and link to it through the navigation file included via PHP.

I know this isn’t the easiest to use article, but I’m a little pushed for time at the moment. Hopefully, that should provide a brief explanation of how this can be achieved. If you don’t understand any part of it, please comment this post.

Post Tags , ,



Leave a Reply