Want to host a blog at your own website without redoing your whole site? You’ve come to right place. Here you’ll learn how to add a WordPress 3 blog to your existing website. There are a few conditions: you should be using PHP, CSS and XHTML and, although it isn’t essential, you should be using includes for common parts of your site like the header, menu and footer. By the way, the Twenty Twelve theme version of this is available here.
This is not a tutorial about making a standard WordPress theme and it doesn’t adhere to the standards set in Designing Themes for Public Release. It is intended to seamlessly incorporate a WordPress 3 blog into your existing website.
Also, it uses a simplified file structure instead of a WordPress child theme. Child themes are great and should be used whenever you can, but I’ve found that for many people overriding the CSS in the parent theme can be too much of battle and just isn’t an efficient use of time.
You’ll need to know some basics:
- how to FTP to your site;
- how to set permissions;
- your database hostname (probably localhost), the database name, your username and your password for the database; and
- some CSS and XHTML basics.
Check out the finished example PHP website with a WordPress blog.
By the way, one might consider the option of redoing the whole site completely in WordPress. It works great.
Download and install WordPress
- Download the latest version of WordPress. Some web hosts offer easy installation options from the website control panel.
- Install WordPress on your server in a new directory. Call it something user-friendly like blog or articles. For this article let’s call it blog. Follow these easy five-minute installation instructions.
- Complete the installation and make sure everything is working. See Common Installation Problems or add a comment below if you’re having trouble.
- Right off the bat you may want to activate the Akismet plugin to help keep spam at bay.
Create the folder for your own theme.
- FTP into the themes folder in your WordPress installation (blog/ wp-content/ themes). Remember, we’re calling the WordPress installation folder blog.
- Create a new folder in themes to hold your theme files. We’ll call it mytheme but you can call it whatever you like.
Create the two can’t-do-anything-without-them files, index.php and style.css.
- In mytheme, add a new empty file with the name of index.php. We’ll come back to this one later.
- Also in mytheme, create a new file called style.css. This file is necessary for WordPress to recognize your new theme.
- In style.css add the following code. Obviously, change what’s necessary to make it your own.
CSS1234567/*Theme Name: My ThemeTheme URI: http://yourwebsite.com/Description: WordPress theme for my existing website.Author: Your NameVersion: 1.0*/
Change the current theme to My Theme.
- Login to your WordPress installation. In this case it would be at blog/wp-login.php.
- Click on Appearance then Themes if you aren’t already there.
- If all went well so far, you should see your theme, My Theme, the version number, your name and the description. Click Activate. If it tells you the theme is broken or similar, go back and check style.css.
- Preview your theme to make sure there are no serious errors. All you should see is a blank page.