Using WordPress.com

WordPress.com (http://wordpress.com) is a free service provided by the WordPress developers, where you can register a blog or non-blog website easily and quickly with no hassle. However, because it is a hosted service, your control over some things will be more limited than it would be if you hosted your own WordPress website. As mentioned before, WordPress.com will not let you edit or upload your own themes or plugins. Apart from that, WordPress.com is a great place to maintain your personal site if you don't need to do anything fancy with your theme or the source code of your site in general. To get started, go to http://wordpress.com and click on the loud orange-and-white Get Started button. You will be taken to the signup page. In the following screenshot, I've entered my e-mail address (please triple-check when entering yours; it's where the confirmation e-mail will be sent), my username (this is what I'll sign in with), a password (note that the password measurement tool will tell you if your password is strong or weak; there's also a Generate strong password button available next to the field), and finally my blog address (WordPress.com also allows you to register a custom domain in place of the standard .wordpress.com subdomain):

Using WordPress.com

After providing all the required information and clicking on the Create Blog button, WordPress will try to sell you on one of their premium packages (WordPress.com Premium and WordPress.com Business). Some of the additional functionalities inside the premium packages include a free .com, .net, .org, or .me domain, advanced customization capabilities, access to a range of premium themes, the possibility to store videos directly on your WordPress.com account, additional disk space (the free account offers 3 GB), and direct e-mail support or live chat support.

For now, we're going to stick with the basic, free account. So just click the Choose Basic button and you'll be redirected to the final confirmation page that instructs you to visit your inbox and search for the activation e-mail that's just been sent. The e-mail itself is very clear and only requires you to click the big Activate Blog button. If you can't see the images, then you might need to check your e-mail software's settings. After clicking the big button, you're back at WordPress.com for some final setting up. The platform asks for things such as Blog Title, Tagline (optional), and Language.

When you're done with that and press the Next Step button, you'll be redirected to the theme selection panel. There are some free and paid themes available there. Additionally, after clicking on a specific theme you have some limited possibilities to customize it. Nothing too fancy, though. For more in-depth fine tuning, one of the WordPress.com premium packages is required.

Clicking on yet another Next Step button will finally allow you to create your first post. WordPress.com is 100 percent ready to welcome any standard type of content, including text, videos, photos, quotes (very popular these days), and links. If you don't want to do this right now, you can just click on the Finish button.

Publishing your first content on a WordPress.com blog

All you have to do in order to publish some content on your WordPress.com blog is click on the New Post link in the top menu:

Publishing your first content on a WordPress.com blog

When you do so, you're going to be presented with a prompt asking you what kind of content you'd like to publish. The current possibilities include:

  • Text post
  • Photo
  • Video
  • Quote
  • Link

WordPress.com has some pre-formatted layouts prepared for each of these types, so it's always good to select the one that is the most accurate. For instance, for a standard text post, WordPress.com will ask you for a title (optional; posts on WordPress.com can be published without a title), the body of your post, and the tags (optional as well), and you'll also be able to add a photo to accompany your publication.

Publishing your first content on a WordPress.com blog

Once you're done editing your post, you can either save it as a draft (for further modifications), preview what it's going to look like on the blog, or publish it straight away with the Publish Post button.

Essentially, a WordPress.com blog can be managed just like any other WordPress site (content-wise), so you do get access to a Dashboard (explained later within this chapter), where you can edit and publish your content, too. The interface described above is a specially designed panel that can't be found on any other type of blog. In other words, you won't get it with a regular WordPress site (a standalone site on your own domain and hosting). Therefore, if WordPress.com is your preferred way of launching a blog, you can probably skip the next section of this chapter, which is exactly all about installing WordPress manually as a standalone site.

Installing WordPress manually

The WordPress application files can be downloaded for free if you want to do a manual installation. If you've got a website host, this process is extremely easy and requires no previous programming skills or advanced blog user experience.

Some web hosts offer automatic installation through the host's online control panel. One of these automatic installation methods is described later within this chapter.

Preparing the environment

A good first step is to make sure you have an environment setup that is ready for WordPress. This means two things: making sure that you verify that the server meets the minimum requirements, and making sure that your database is ready.

For WordPress to work, your web host must provide you with a server that does the following two things:

  • Support PHP, which has to be Version 5.2.4 or greater
  • Provide you with a MySQL database (full access); MySQL has to be Version 5.0 or greater

Additionally, these minimum requirements tend to change every once in a while. The most current requirements can always be found at http://wordpress.org/about/requirements/.

You can find out if your host meets these two requirements by contacting your web host. If your web server meets these two basic requirements, you're ready to move on to the next step.

As far as web servers go, Apache is the best. However, WordPress will also run on a server running the Microsoft IIS (Internet Information Services) server (though using permalinks will be difficult, if possible at all).

Tip

Enabling mod_rewrite to use pretty permalinks

If you want to use permalinks, your server must be running Unix, and Apache's mod_rewrite option must be enabled. Apache's mod_rewrite is enabled by default in most web hosting accounts. If you are hosting your own account, you can enable mod_rewrite by modifying the Apache web server configuration file. You can check the URL, http://www.tutorio.com/tutorial/enable-mod-rewrite-on-apache, to learn how to enable mod_rewrite on your web server. If you are running on shared hosting, ask your system administrator to install it for you. However, it is more likely that you already have it installed on your hosting account.

Downloading WordPress

Once you have checked out your environment, you need to download WordPress from http://wordpress.org/download/. On that page, the .zip file is shown as a big blue button because that'll be the most useful format for the most people. If you are using Windows, Mac, or Linux operating systems, your computer will be able to unzip that downloaded file automatically. (The .tar.gz file is provided because some Unix users prefer it.)

Tip

A further note on location

We're going to cover installing WordPress remotely. However, if you plan to develop themes or plugins, I suggest that you also install WordPress locally on your own computer's server. Testing and deploying themes and plugins directly to the remote server will be much more time-consuming than working locally. If you look at the screenshots of my own WordPress installation throughout the book, you'll notice that I'm working locally.

After you download the WordPress .zip file, extract the files, and you'll get a folder called wordpress.

Upgrading from an earlier version of WordPress

If you are upgrading an existing installation of WordPress, you should probably leave this chapter and instead read the section on Upgrading WordPress in Chapter 12, Creating a Non-blog Website Part Two – Community Websites and Custom Content Elements.

Uploading the files

Now, we need to upload all these files to our web server using any FTP client (or simply put them in our local server directory on our local computer). FTP stands for File Transfer Protocol. There are several FTP clients available on the Internet, which are either freeware (no cost) or shareware (a small fee). If you don't already have an FTP client, try one of these:

You can also use the popular web-based FTP application net2ftp at http://www.net2ftp.com. These services are useful if you don't want to install a desktop application on your computer. You can also check if your host provides browser-based FTP software.

Note

A note about security

Whenever possible, you should use Secure FTP (called sFTP) rather than regular FTP. If you're using sFTP, all of the data sent and received are encrypted, whereas with FTP data are sent in plain text and can be easily nabbed by hackers. Check both your FTP software and your hosting options, and select sFTP if it's available.

Using your FTP client or service, connect to your FTP server using the server address, username, and password provided to you by your host. Next, open the folder where you want WordPress to live. You may want to install WordPress in your root folder, which will mean that visitors will see your WordPress website's home page when they go to your main URL – for example, http://yoursite.com. Alternatively, you may want to install WordPress in a subfolder; for example, http://yoursite.com/blog/.

On the left side, you will see the files from your local folder, and on the right side you will see your remote folder. (Note: the FTP client you are using may have a slightly different layout, but this is the general idea.)

Now select all of the WordPress files on your local machine from the left pane, and drag all of them to the right pane. You can watch as your FTP client uploads the files one at a time and they appear in the right panel. This could take a few minutes, so be patient!

If you're installing WordPress on your local server, just be sure to place the WordPress files in the correct webroot directory on your computer.

Once all of the files are done uploading, you're ready to do the installation.

Installing WordPress

Now it's time to install WordPress through the famous five-minute installation (the fact that WordPress can be installed in five minutes or less is widely advertised on the official WordPress website). If you access your WordPress URL via your browser, you will see a short introduction message instructing you to create a file named wp-config.php by clicking on the button labeled Create a Configuration File. After doing so, you will be presented with another screen, informing you about all the required details you'll need in order to complete the installation successfully.

Currently, these required details consist of the following:

  • Database name: for example, wptestblog
  • Database username: for example, localdbuser
  • Database password: for example, 62dcx%^_0hnm—the more complex the better, as usual with passwords
  • Database host: for example, 1.1.1.1 – most of the time, you will be required to provide an IP address of your database host (if needed, you can take a look at this handy cheat sheet for an in-depth explanation of all the possibilities: http://codex.wordpress.org/Editing_wp-config.php#Possible_DB_HOST_values); in case of servers running locally on your own machine, the database host is most likely localhost

The big question, therefore, is where to get all this information from. Simple answer—your web host. Most of the large web hosts offer a way to create your own databases via an online control panel, with usernames and passwords of your choice. If you're not sure how to do this, just e-mail or call your hosting provider for assistance. Professional support teams will be glad to help you with this.

Once you have those four things, you can press the Let's go! button and proceed to the next step of the installation. This is what the main setup form looks like:

Installing WordPress

As you can see, I filled out mine with the details mentioned as an example a couple of paragraphs above. Of course, your details will be different. Also, one more thing worth pointing out: there's an additional field labeled Table Prefix. This is the default prefix that every table in your database will have before its name. The default value in that field is wp_. I advise you to change this to whatever two-letter or three-letter word you wish and end it with an underscore (_), just as a safety precaution against standard database attacks on known WordPress tables. The one I used is wtb_. One more additional reason for using a custom prefix is to enable you to take advantage of the WordPress multisite feature (if you plan to launch more than one site with a single WordPress installation, which is also possible). In such a case, you'll need to use different prefixes in your different installations.

After clicking on the Submit button, you will be redirected to the final confirmation page. All you have to do here is click on the Run the install button.

At this point, things can either go well, or not that well. In case of the latter, proceed to the next section, Installing WordPress through a hand-built configuration file. Luckily, such problems are rather rare. The best indication that the online installation is going well is the presence of the following screen:

Installing WordPress

This is the final setup page. Here, you get to set up the core details of your new site. (If you've ever installed an earlier version of WordPress, you'll notice some differences, such as the ability to choose your first username and password.) Now, fill out the installation form (you will be able to change all of these later, so don't be too worried about getting locked into your choices):

  • Site Title: Fill in the name of your blog (it can be something simple, such as Daily Cooking, for example).
  • Username: Note that the default username is admin, but for security purposes, you're better off picking something different. If someone ever tries to hack into your blog, he or she will be halfway there if he or she already know your username. Also worth pointing out is the fact that this account is the administrator account, which has the most privileges and access rights in all areas of the site.
  • Password: Choose a secure password, one that has both the upper and lowercase letters, a number or two, and even a few punctuation marks.
  • Your E-mail: Double-check that this is correct. This is the e-mail address WordPress will use to contact you about the blog, comments, and so on. If you do not get an e-mail from your WordPress site shortly after installing, check your spam folder.
  • Privacy: This is the final checkbox, yet possibly one of the most important settings on this list. If you leave it checked (recommended), your site is going to be accessible through Google and other search engines. Unchecking it means banning your site from the search engines.

Now, click on Install WordPress. You're done with the installation.

You can click on Log In to get to the login page. Or you can always enter your WordPress Admin panel (also known as the WP Admin) by pointing your browser to http://yoursite.com/wp-admin. If you're not already logged in, this URL will redirect you to the login page.

Installing WordPress through a hand-built configuration file

Now, in some cases your web hosting account will prevent WordPress from creating a valid configuration file. It can be an issue caused by access rights limitations, for example. However, it's not a big obstacle because you can always create a configuration file by hand. To do this, just open the wordpress folder and find the file named wp-config-sample.php. Make a copy of this file and name it wp-config.php.

We'll modify this file together. Don't worry; you need not be a PHP programmer. Just open this file with a simple editor such as Notepad. The following is the copied text from the original wp-config.php file. Note that I've removed most of the comments, so that we can focus on the items we need to change.

<?php
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

$table_prefix  = 'wp_';
?>

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

One thing to know about PHP is that any text that comes after a double slash (//), or between a slash-star and star-slash (/* */), is a comment. It's not actual PHP code. Its purpose is to inform you what that line or that section is about. As you can see from the previous code, there are a number of settings that you can insert here, but they do resemble the ones we were filling out in the online installer just a minute ago. Let's walk through the most important ones.

Just as with the online installer, I took my database information, but this time I put it in the wp-config.php file:

// ** MySQL settings ** //
define('DB_NAME', 'wptestblog');  
define('DB_USER', 'localdbuser');  
define('DB_PASSWORD', '62dcx%^_0hnm');
define('DB_HOST', 'localhost');

Next, for security purposes, you really should put some unique phrases into the unique keys. The secret keys are used by WordPress to add random elements to your passwords and are also used in some other situations. This will help to keep your WordPress installation uniquely protected. No one else is likely to choose the same unique keys that you chose, and therefore, breaking or hacking into your site will be more difficult. You can get some secret keys generated by going to https://api.wordpress.org/secret-key/1.1/salt/. Once I did that, I got the following, which I can paste directly over the default code in wp-config.php:

define('AUTH_KEY', 'uu|6#00Pc/3h?Pg5:Zc#:S=;<3mdw-ai');
define('SECURE_AUTH_KEY', 'vy1.@Nr@Zb^G|0Vfz-|TH5&W');
define('LOGGED_IN_KEY', 'sryMVd'jVpiMWWQqx~!v XE5@fJMTt2[Z');
define('NONCE_KEY', 'i,+UPpMR>Mj3o}(B**^<T:/md,YFF76d]Kf');
define('AUTH_SALT', 'n.8Li=9OjV+_p|}e5yN2k<s{!KJs|[S&Zh');
define('SECURE_AUTH_SALT', 'I#2vPT^u[5vLX|'MzPg/J*y]RTfr');
define('LOGGED_IN_SALT', 'gR%QP^c*jfFUy,iQ}-0g_%;%H)pN0B5');
define('NONCE_SALT', '&L);.IH'v{]zYLO2:h_t#J0D-p)cvyc');

Note

Don't ever get the salt keys from anywhere else than https://api.wordpress.org/secret-key/1.1/salt/. This is an important security mechanism that protects your browser's session from being hijacked and then used for unauthorized access to your WordPress site.

Finally, we have the aforementioned table prefix. The wp-config.php file allows us to set this too. Again, here's my prefix of choice:

$table_prefix  = 'wtb_';

The WordPress codex has a long and detailed page that describes everything about editing your wp-config.php file: http://codex.wordpress.org/Editing_wp-config.php. Once you save the wp-config.php file and either upload it to your web host or put it on your local server, you can visit your site through your domain name (like http://yoursite.com/). Youshould be presented with the final setup page, the one visible in the preceding screenshot. All you have to do now is proceed according to the instruction described earlier in this chapter.

Learning more

If you'd like to see an even more detailed step-by-step guide for manual installation, take a look at this page in the WordPress Codex: http://codex.wordpress.org/Installing_WordPress.

Also, you can find more detailed installation instructions—as well as specifics on changing file permissions, using FTP, using languages, importing from other blogging engines, and more—in the WordPress Codex at the following link: http://codex.wordpress.org/Getting_Started_with_WordPress#Installation.

Installing WordPress through an autoinstaller script

Some web hosts provide their customers with access to a range of autoinstaller scripts for various web platforms, including WordPress. Most of these autoinstallers have quite similar functionalities and the actual process of installing a new WordPress site is similar as well. Here, we're going to focus on one of these scripts—Softaculous.

Note

This is yet another way of installing a WordPress site, and we're covering it here to make this book as complete as it can be; however, if you've already managed to install your site through the methods described earlier, this section won't be of any use to you at this point.

Softaculous is the preferred method of WordPress installation for many professional developers and bloggers. In some cases, it's the fastest method when dealing with a completely new hosting account maintained by a new web host. Softaculous is provided on hosting accounts running on many management platforms, such as cPanel, Plesk, DirectAdmin, InterWorx, and H-Sphere. Most likely, your hosting account (a commercial hosting account you've bought from a respected provider) is certain to be using one of these platform.

Here's an example of what cPanel—one of the platforms—looks like:

Installing WordPress through an autoinstaller script

Although various platforms have different user interfaces, the core functionalities from a user's point of view remain mostly the same. To access Softaculous, just scroll down until you see the main icon labeled Softaculous. After clicking on it, you're going to be redirected to the control panel of Softaculous, where right in the center you can see the WordPress icon along with an Install button that becomes visible when you hover your mouse over the icon.

The whole idea of using this script is to make things quicker and more hassle-free; therefore, you don't have to take care of creating databases manually, setting configuration files, or anything else. Softaculous will handle all of this for you. The following is the site creation form:

Installing WordPress through an autoinstaller script

Here's a breakdown of all the fields and what details to fill them out with:

  • Choose Protocol: You can stick with the default value of http://
  • Choose Domain: If you have more than one domain assigned with your hosting account, you get to choose which one you want to use here; for single domain accounts (most likely the case), this drop-down field has only one option
  • In Directory: If you want to install your WordPress site under a subdirectory, input its name here (just the name); if you want to install the site in the main directory (http://yoursite.com/), make sure the field is blank
  • Database Name: You can confidently go with the default value
  • Table Prefix: As discussed earlier in this chapter, change this to something unique (in my case, it's wtb_)
  • Site Name: The name of your site (in my case, Daily Cooking)
  • Site Description: The tagline (in my case, Exploring cooking every day of the week)
  • Enable Multisite (WPMU): Leave it unchecked unless you're an advanced user planning to launch a multisite installation
  • Admin Username, Admin Password, and Admin Email: The details of your admin account, similar to the ones we had to provide during the manual WordPress installation
  • Select Language: WordPress has many localized versions of the platform, not only English; you can choose one here

After clicking on the Install button the installation process will begin. The process itself requires no supervision and you will be able to access your site as soon as it finishes after roughly one or two minutes. You can check if the installation has been successful through the standard http://yoursite.com/ and http://yoursite.com/wp-admin/ URLs. In other words, this is the end of the installation process through Softaculous. As you can see, it's much simpler and quicker than doing it manually. Furthermore, Softaculous always installs the most recent version of WordPress, so you don't have to worry about getting something out of date.

Note

You can also encounter other auto-installer scripts, very similar to Softaculous. For example, Fantastico, Installatron, and SimpleScripts.