Friday, August 8, 2008

How to Build a Blog With WordPress

Tired of toying with the puny tools that cookie-cutter blog services provide? Follow the steps in this easy guide to install a WordPress blog on your own domain and personalize your Web presence.

Zack Stern, PC World

If blogging is all about self-expression, why do so many blogs look so blah?

Limitations of free blog sites; click for enlarged image.Most beginner "blahgs," it seems, are generated using free services whose customization options are meager at best. But you can break the monotony and supercharge your Weblog by installing your own blogging software and customizing it as you like. You'll control how your site looks and functions--and when you're finished, you'll have a distinctive-looking blog that you can easily update to keep it fresh and functional.

Dozens of great blogging tools are available, and PC World has rated several of them. Among the most popular and versatile of these is WordPress. You can easily scale it to your needs, so it can handle a basic family blog or a professional blog or news site with equal aplomb. The latest version, WordPress 2.5, offers photo gallery support, powerful media management options, multiple file uploading, a new look, and more. And because it supports a host of plug-ins and widgets, you can quickly introduce additional features as needed.

I'll explain how to get started with the installation, how to customize your blog, and how to create posts. If you just want to dabble with a free, hosted WordPress site, visit WordPress.com; But if you want to take full control of WordPress's powerful content management and site design features, including your own personal domain name, you'll need the WordPress software (note that the free software is available at WordPress.org, not at WordPress.com) and a Web hosting account to install it on. Using the WordPress software, you'll be able to adjust a multitude of settings to craft your own unique, easy-to-manage site.

What You'll Need

To get started with your WordPress blog, you'll need four or five basic things.

  1. A Web hosting account with PHP version 4.3 and MySQL version 4.0 or later enabled.

  2. A MySQL database to store your blog's data in. You'll create this during the WordPress installation process.

  3. A text editor, such as Notepad (on Windows) or Text Edit (on the Mac). A simple text editor produces better results than a full-blown word processor such as Microsoft Word.

  4. An FTP client, such as FileZilla for Windows or CyberDuck for Mac, to simplify and accelerate the process of uploading the WordPress installation files to your hosting service.

  5. An image editor, though optional, can be very helpful if you want to create your own custom themes. One good, free option is The GIMP (that is, the GNU Image Manipulation Program), which includes many features that rival Adobe Photoshop provides, minus the price tag.

  6. Install WordPress

    Rename 'wp-config-sample.php'; click for enlarged image.WordPress requires PHP version 4.3 or higher, and MySQL version 4.0 or higher. These tools allow WordPress to execute scripts and manage databases that instantly propagate your Web page. Check with your Web host to confirm that it supports these pieces and that they are installed successfully; the vast majority of hosting companies offer these features as part of their standard services.

    At the heart of every WordPress blog is a MySQL database that contains all of its posts and settings. It's a good idea to set up this database on your host server before you start working with individual WordPress files. That way you can customize your configuration file before uploading it, which is a significant time saver.

    To create the database, log into your hosting service's control panel--cPanel, phpMyAdmin, Plesk, or whatever the interface may be. Somewhere in the main control panel, you should see a listing for MySQL databases. My host uses cPanel, so I clicked the MySQL Databases icon, typed in a name for my new database--'wordpress'--and clicked Create Database. I also typed in a new user--'blog'--and password, and then clicked Create User. You can choose whatever names you like for your database and user, but your process should be similar to mine.

    If you haven't already, you should download the free WordPress software to your computer and extract the files onto your desktop. All of them should be contained in a folder labeled 'wordpress'. Within the wordpress folder, locate the file named 'wp-config-sample.php' and rename it wp-config.php. Then open this file in a plain-text editor (such as Notepad on Windows or TextEdit on a Mac), and replace 'putyourdbnamehere', 'usernamehere', and 'yourpasswordhere' in the file with your database name, your user name, and your password, respectively. Leave the other formatting--such as spaces and single quotes--intact.

    Now upload the WordPress files--excluding the outer wordpress folder itself--to the root directory of your host account. You'll probably want to use one of the FTP programs mentioned earlier under "What You'll Need" to move everything swiftly, instead of pursuing the click-heavy method of doing everything within a browser-based control panel.

    The folder that you place all of your content in will determine where visitors go to see your blog. If you want the root page to contain the blog, put everything into a directory on your host. If you want to store the page at another URL, such as 'http://mywwebsite.com/blog', create a folder named 'blog' at that level, and put the WordPress files inside. The root directory for your hosted Web site will usually have a name like 'public_html' or 'http_docs'.

    Finish the installation with your Web browser. Visit the directory where you made the installation, plus the extension 'wp-admin/install.php'. For example, if you put everything in a folder named 'blog', visit 'http://mywebsite.com/blog/wp-admin/install.php'. If the WordPress files are in your root Web directory, go to 'http://mywebsite.com/wp-admin/install.php'. Enter basic details such as the blog name and your e-mail address, and click Install WordPress.

    That should complete the initial installation. Visit your blog URL in another window to see how the site looks to the outside world. If you notice a problem, consult the troubleshooting tips related to your specific situation at the WordPress Codex.

  7. Design Your Blog

    The WordPress themes editor; click for enlarged image.Your WordPress blog can be customized to an astonishing degree, giving your site unique functionality in addition to a distinctive look. I'll explain how to make simple design tweaks, how to import free themes that bring their own style, how to add plug-ins for custom functionality, and how to create your own custom theme.

    Log in to your dashboard by visiting 'http://your-domain-name.com/wp-admin'. (This location is the same as the directory where you uploaded the files.) Click the Settings tab in the top right to make a few initial alterations. Change the blog title, the tagline, and the time zone as needed. Click Save Changes.

    You can make simple adjustments to the blog header through the 'Design', 'Header Image', and 'Color' tabs. Click the buttons to adjust the font color, and change the background gradient by clicking Upper Color and Lower Color. (Use the same color if you want a solid layer.) Click Update Header to modify your blog immediately.

    For a larger-scale change, try replacing the default themes. New themes shuffle all of your post details into different layouts and looks, and many themes are free to download through WordPress and other sites. Visit the WordPress Theme Viewer to sample officially tested designs.

    I like to check a few of the design options in the left menu, such as '2 columns' and 'right sidebar' to narrow the results; then I browse through the choices. Another option is to type a word in the upper-right search box. Try searching for 'wind', 'rain', 'night', and other poetic descriptors to see the range of different designs. If you like one theme, be sure to check out others from the same designer; to do this, click the More themes by this author link.

    Once you find one or more themes that could work for your site, download them to your computer. Themes should come with installation instructions, but in general you just upload their folder into '/wp-content/themes'. Back in your 'Design, Themes' tab, click the new theme to apply it to your site instantly.

    Build Your Own Theme

    Building a theme from scratch can be daunting, so I recommend that you dive into the theme development page at the WordPress Codex before getting started. Or check out the 5-minute tutorial at BotHack for a brief introduction to how themes work.

    Before I learned how to build my own theme from scratch, I used the Wordpress Theme Generator to save time. Though it permitsa much smaller degree of customization, it easily manipulates many settings to produce a unique look quickly.

    To begin, visit the free site. The left column controls your settings, and the right side offers a live preview of how the page will look. Step through the options to make your own design. The 'Site name' section controls your masthead logo. Click the white box to change the font color, or enter the URL for your custom JPEG or GIF image. Any custom graphics will be referenced from their original location, not downloaded into a theme--so if you change or erase the original files, your blog will lose those graphics. I recommend that you upload them to your server and then enter that URL.

    I retained a two-column design but customized the background pattern and text colors. If appropriate, click the Preview button in the lower-left corner to refresh the right pane as you adjust settings. I ran into a few bugs--in particular, I had trouble changing an already-entered image URL--but with a little patience, I got everything set up. Click the Save button to generate the theme as a ZIP file. Then extract the ZIP file, and upload the full theme folder containing the PHP and other files to your server's '/wp-content/themes' directory. In the WordPress dashboard, select the Design, Themes tab, and click the new theme to make the change.

  8. Log In and Create a Post

    Your blog is built and (mostly) configured. In just a few more steps you'll be able to begin posting. The initial user is named 'admin', and this is the name that will appear as the author signoff on posts. Click the Users tab to add your own identity. Fill in the details, and choose the role of Administrator to give your new account full powers. If other people will be contributing to your blog, give them limited powers. An Editor can create posts and publish content from other writers but can't access all of the admin settings; an Author can write and publish posts; a Contributor can write but not publish posts; and a Subscriber can write comments but not posts.

    The Write Post interface; click for enlarged image.When you're ready to post, log out and then log back in using the new account. Click the Write button in the upper-left part of the screen, and begin blogging. Create a title and some text. I like to write the body of my post offline in a plain-text editor and then paste it here. That way, if my Internet connection or browser breaks, I won't lose any work. Either way, click the Save button on the right frequently as you progress.

    Use the word processor-style toolbar to introduce boldface type, create lists, and otherwise format text. If you need to work directly with the HTML--for example, if you want to copy and paste an embeddable video--click the HTML tab. This view shows the underlying commands and allows direct editing. If you write HTML commands in the Visual tab, they'll appear as regular text in the body of your post.

    Add Media

    The Gallery interface; click for enlarged image.WordPress lets you create image galleries in posts. Put the cursor where you want a single image or gallery. Click the rectangle picture icon. (When you hover your pointer over it, it says 'Add an Image'.) Click Choose files to upload to transfer your own pictures to your server. Select one or more of them, and wait until the progress bars finish adding them. WordPress will read tags and other data embedded in the images, and then it will resize them and format them for your site.

    In the Gallery tab, click Show to adjust these details, change the title, and add a description. Save those changes, and then click Insert gallery into post. WordPress then adds the '[gallery]' tag to the plain-text view; this content will become your image gallery when published.

    To add video files, click the Add Video icon. Doing so will upload your finished video to your own server. That's fine if you know how to compress everything via your editing software, but it's not ideal if you haven't preprocessed the file for Web use. So instead I recommend uploading video to another site, such as Vimeo or YouTube, that will automatically format the clip for Web viewing. From there, click the option to embed the video into another page, and copy the embed code. Back in your post, click the HTML view, and paste the code.

  9. Tag and Manage Content

    Your next task is to add tags. These simple words and phrases help readers find posts on the same topic, just as image tags do for photos. Use keywords that describe the post, specify what it's about, and even identify proper names of things inside. Separate the tags with commas, and click Add.

    Categories offer an organizational structure similar to tags, except that--depending on your layout--WordPress can instantly create navigational tabs for each category. This arrangement works great if your blog has a few repeating themes, such as "work," "soccer," "cooking," and "family." I recommend that you make as many tags as you can think of--even five or so for a single post--but try to limit your categories to a few main topics. Type a name, and click Add, or use the checkboxes below to designate the category.

    Click Save on the right, and click Preview this Post. If it looks good, click Publish. If you prefer to schedule the post to go live at a certain time, click Edit, and enter the future date and time when you want this to happen.

    Post Via E-Mail

    WordPress 2.5 can publish posts that you or others e-mail to a specific address; this ability is ideal for occasions when you want to send content from a phone away from a computer. But the default process has drawbacks: It doesn't work with SSL accounts, it requires POP3, and currently it doesn't work with photos. For these reasons I prefer the free plug-in, Postie. Besides overcoming the preceding limitations of WordPress 2.5's e-mail process, Postie can be instructed to publish only e-mail sent from a specific address, which enhances your security.

    Create a new, secret mail account exclusively to use with WordPress content, and upload the 'postie' folder to /wp-content/plugins. Create new folders in your main directory called wp-photos and wp-files where Postie can save its data. (Make sure that they're write-accessible on your server.)

    Postie; click for enlarged image.In WordPress, click Plugins near the upper-right. Activate Postie. Log out and then log back in as an administrator. Click Settings, Configure Postie. Enter any e-mail addresses that you want to permit to post entries to the blog. Leave the other settings at their default values, scroll down to the end, and enter your e-mail account settings. Click Update Options, and click Test Config. If you run into any problems, check to confirm that the e-mail account details are correct.

    Postie should be ready to go, but you'll need to create a scheduled Unix command that regularly checks the e-mail account for new messages. In your server configuration tool, open the Cron Jobs tool and create a new job. In it, paste the text */5 * * * * /usr/bin/lynx --source http://www.mywebsite.com/wp-content/plugins/postie/get_mail.php >/dev/null 2>&1 to cause WordPress to check for new mail every 5 minutes. Now you're ready to mail in your posts. Postie will use your e-mail subject line as the title of the post, and the body of your message will become the body of the post.

No comments:

How to Get files from the directory - One more method

 import os import openpyxl # Specify the target folder folder_path = "C:/Your/Target/Folder"  # Replace with the actual path # Cre...