WordPress is a CMS that can be installed in a few minutes with the help of an easy-to-follow tutorial. Throughout this book, we have implemented a personal portfolio management application with advanced users. This compact tutorial is intended to help you set up your WordPress installation with the necessary configurations to be compatible with the features of our application. Let's get started.
We are using WordPress 3.6 as it's the latest version available at the time of writing this book. So, we have to download Version 3.6 from the official website at:
First, we need to create a folder for our application inside the web root directory. Then, we will extract the contents of the downloaded ZIP file into the application folder. Finally, we have to provide the necessary permissions to create files inside the application folder. Make sure you provide the write permission for the wp-config.php
file before starting the installation. Generally, we can set the permission for directories as 755
and for files as 644
. You can learn more about WordPress file permissions at:
http://codex.wordpress.org/Hardening_WordPress#File_Permissions
Initially, our application will be running on a local machine with a local web server. There are ways of working in the local environment:
Create a virtual host to run the application
Use the localhost to run the application
Virtual hosts, often referred to as vhosts, allow us to configure multiple websites inside a single web server. Also, to refer to our application, we can match a custom URL. This method should be preferred in web application development as the migration from a local to a real server becomes less complex.
Let's say we want to run the portfolio application as www.developerportfolio.com
. All we have to do is configure a virtual host to point the application folder to www.developerportfolio.com
. Once set up, this will call the local application folder instead of the actual online website.
By using the actual server URL for the virtual host, we can directly export the local database into the server without changes.
The following resources will help you to set up a virtual host on different operating systems:
Open a web browser and enter your application URL mentioned previously to get the initial screen of the WordPress installation process, as illustrated in the following screenshot.
We have to manually create the database before starting this installation process. So, create a new database from your favorite database editor and create a database user with the necessary permission to access the database.
Then click on the Create a Configuration File button which will load the screen shown in the following screenshot:
The preceding screenshot displays all the information needed to continue with the installation. After reading the contents, click on the Let's go! button to get the next screen as shown in the following screenshot:
Here, we have to enter the details to connect to the database. Use the details in the database-creation process to define the database name, user, password, and database host. Finally, we have to enter the table prefix. By default, WordPress uses wp_
as the prefix. It's ideal to set a custom prefix like a random string for your tables to improve the security of your application. Once all the details are entered, click on the Submit button to get the next screen as shown in the following screenshot:
Note
Also, we can use the WP Better Security plugin to generate a random prefix and update the database.
Click on the Run the install button to get the next screen as shown in the following screenshot:
Fill in the form with the requested details. By default, WordPress uses admin
as the username. Ideally, you should be using a custom username as the admin role to improve the security of the application. Once all the details are filled in, submit the form to complete the installation and you will get the following screenshot:
The details of your admin account will be displayed on this screen. Click on the Log In button to get the login form and log in to the admin area. Now we are ready to go.
Permalinks allow you to define the custom URL structure for your posts, pages, and custom URLs using mod_rewrite
. By default, WordPress uses query parameters to load posts and pages through IDs. Usually, we change the existing URL structure to provide a neat URL. So, navigate to Settings | Permalink on the admin menu and you will find different URL structures. Select the Post name option for the URL and click on the Save button. Your screen should look something similar to the following screenshot:
We have used a free theme called Responsive for the developer portfolio management application of this book. We can download the Responsive theme from the official WordPress themes directory at http://wordpress.org/themes/responsive. Then, we have to copy the extracted theme folder into the /wp-content/themes
directory of our application.
Now we have to activate the theme from the WordPress admin panel. Choose Apperence | Themes from the left menu and click on the Activate link under the Responsive theme.
Now copy the wpwa-web-application
plugin into the /wp-content/plugins
folder. Use the Plugins section on the admin menu to activate the plugin for this book.
Now we have completed the process of configuring WordPress for our portfolio management application. Open the web browser and enter the URL as http://www.yoursite.com/user/register or http://localhost/application_folder/user/register
based on your URL structure to load the registration page of the application. You can use the menu and forms to navigate through the site and check all the features built throughout this book.