WordPress is a weblog publishing tool written in PHP. It's open-source software, so you are free to use it or modify it as you wish. You can download WordPress at http://wordpress.org/. The first step is to extract the file in the place where you want to install your weblog. The files in the archive are all inside a folder called wordpress, but you can move them into another directory if you like.

Once you've extracted the archive, you should copy the wordpress directory to a directory accessible as part of your website. If you want your weblog to reside at the root directory for your server, copy the files out of the wordpress folder and directly into your document root directory. Visiting the home page of your WordPress installation will quickly illustrate the difference between using a hosted service and running an application on your own. You're greeted with a request to create a configuration file, as shown in Figure 21.5.

Figure 21.5. WordPress needs a configuration file to get started.

In your WordPress directory, you'll find a file named wp-config-sample.php. To set up WordPress, you need to copy this file to a file named wp-config.php and enter your database settings. If you are deploying WordPress to a server where you don't have a shell account and can't edit files directly, you must create and edit this file before you upload your files to the server.

I'm installing WordPress on my own computer, so I created the database and database user myself. If you are installing WordPress on a shared hosting account, chances are you've gotten the database login information from your hosting provider. In some cases, you may want to install several different applications, or perhaps even multiple installations of WordPress in the same database. In that case, you'll want to look at the following line in wp-config.php:

$table_prefix = 'wp_'; // Only numbers, letters, and underscores please!

This is the string that WordPress puts on the front of the names of all the files it creates. If you already had one WordPress installation using a database, you'd want to change this prefix to something else so as to prevent the two installs from conflicting. I have created a database just for this purpose, so I'll leave the prefix as is.

Once you have wp-config.php in place, you can proceed with the installation. If you reload the index page in the WordPress directory, you'll be referred to install.php, unless there's a problem with your database configuration. If WordPress can't connect to the database using the settings you provided, it will print an error message. Make sure you have all the information on your database entered properly and test your database connection using this page until WordPress stops complaining.

In the first step of the actual installation, shown in Figure 21.6, you pick a name for your weblog and enter your email address. Once you've done that, WordPress creates all the database tables it needs and generates an account for you to log into the system. That's it for installation.

Figure 21.6. The WordPress installation page.

Once you've completed the installation, you're presented with the Dashboard for your weblog. It's not all that different from the Control Panel for TypePad. The posting page, shown in Figure 21.7, is even more similar to TypePad and most other weblog tools. You can enter the title and body of your post, along with some other optional information. The options on the right side enable you to mark your post as draft or published as well as categorize it. You can select from other options as well.

Figure 21.7. The posting page for WordPress.

The posting page isn't all that interesting. Where WordPress differs from TypePad is in how much control you have over the layout and design of your weblog. With WordPress, all the work you've done learning HTML, CSS, and PHP can really pay off. Clicking on the Presentation tab and then on Theme Editor enables you to edit all the files that make up the published side of your weblog from within your browser (see Figure 21.8).

Figure 21.8. Editing part of a WordPress theme.

You can see the actual source code for index.php, the main page of my WordPress site, in a <textarea> element. Any changes I make to the file will be saved to disk, and the next time I view the front page of my weblog, I'll see them.

Needless to say, if you know how to edit these files, you can customize WordPress to your heart's content. If you don't want to make changes to your WordPress theme by hand, you can download and install themes that other people have created at http://wordpress.org/extend/themes/. You can download the themes and place them within your WordPress installation so that they can be applied to your weblog. You can also use those themes as starting points to create your own custom theme.

The functionality of WordPress can also be extended using plug-ins. This is yet another advantage of running your own installation of WordPress. Not only can you create your own themes and install themes created by other people, but you can also extend WordPress using plug-ins that you download or you can write the new functionality yourself. A directory of available plug-ins can be found at http://wp-plugins.net/. This directory contains hundreds of plug-ins for WordPress.

Installing plug-ins is straightforward. Let's say I want to install the Related Posts plug-in, which automatically lists posts related to the post currently being viewed in WordPress. First, I go to the download site and download the plug-in. Here is the site for Related Posts:


Once I've downloaded the file, I just have to copy the plug-in itself into the wp-content/plugins directory in the WordPress installation directory. At that point, I can click on the Plugins tab inside WordPress and I should see that the Related Posts plug-in is installed, as shown in Figure 21.9.

Figure 21.9. The Related Posts entry on the WordPress Plugins page.

Once the plug-in is installed and activated using the Activate button on the Plugin list, I can configure the options for the plug-in using the Related Posts Options tab that appears once the Related Posts plug-in is activated. Then all I have to do is go to my single-page archive post and find a spot for the related_posts() call to include the list of related posts.

Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day
Sams Teach Yourself Web Publishing with HTML and CSS in One Hour a Day (5th Edition)
ISBN: 0672328860
EAN: 2147483647
Year: 2007
Pages: 305

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net