Today's Most Popular

Recent Comments

Incoming Search Referrals

Posts Recently Commented

Real Estate Investing and Finance

News

Politics

Linux How To

The Tech Blog




Incorporating Any Site Into WordPress

If you know me, then you know that I really like WordPress. It may not win any awards for the most efficient PHP out there, but it is a very easy to install and use blogging platform and CMS (Content Management System). So, today I am going to start on a series of articles for WordPress beginning with how to incorporate your website’s current layout into WordPress so that you can add on a blog or other CMS driven area to your website and have it look like it belongs there.

Templatetification

Ok, let’s start with the basics. I assume that you have managed to install and configure WordPress on your server. This is really a very easy thing to do, but I will probably have a little how-to up here shortly for people that don’t know how to do this. But, at this point, that is beyond the scope of this discussion. My new word, templatetification, is my way of talking about making the layout of your site into a number of template type files. Most of the time, I cut up the layout of our sites into basic files like, header.php, left.php, right.php, footer.php, etc.. Inside of these files is the code that is replicated on every page of the site in a specific location. The header.php file typically has everything found in the layout from the html declaration on down to the first line of html that is displayed in the main content area of my page. This way, I can use PHP includes or SSI (Server Side Includes) to pull that content into each page on the fly. This makes additions to menu bars, headers, footers, and other parts of the site go live simply by making a change to one file. Let’s take a look just so we are all on the same page:

< ? include('header.php') ?>

Welcome to Mysite.com

Ok, so in this brief example, the header.php file might include things like links to my stylesheet, character set declarations, the closing

tag,

tag and any other items I would like to include up in that region.  There are a lot of other resources on the web for site management using includes.

Ok, hopefully you have an idea of what I am talking about here or already are up to speed on managing your sites using PHP includes or SSI. With that said, we can move on to getting your site integrated into the WordPress system. Wordpress’s “default” theme, called Kubrick, uses a simple set of files to build the site layout and display content. Integrating this layout into your site’s template is very easy to do once you understand how they have laid things out.

Use PHP

One of the first recommendations I have is to use PHP on your sites. PHP has become the most widely used scripting language for web applications it seems and I can understand why. I decided a few years ago to drop SSI and use PHP to handle site management and “includes” duties. One of the biggest benefits of using PHP to handle includes over SSI is that you can include and include inside of an include with PHP, but not with SSI. This can be a big help when you may want to include a file of links (say, your left navigation bar) into a file that you might call sidebar (which displays your navigation links, advertisements and other items). This way, you can insert different navigation files depending on what part of your site you are on, without having to tear up your template each time. I parse html files for php on my sites which makes having to use .php file extensions on my site’s files unnecessary. This can be done in a couple of ways, but the most simple is to enable it in the main .htaccess file for the site in question. You can do this by entering this line into the .htaccess file (or make one) in your document root:

AddType application/x-httpd-php .php .htm .html

One Response to “Incorporating Any Site Into WordPress”

  1. Shiv Majumdar Says:

    I am looking for setting up a wordpress powered article directory.

    Can I get help on that?

Leave a Reply