Getting Started With WordPress for Developers and Webmasters
Introduction
As I embarked on my journey with WordPress, I came across several great resources on the Net that covered different aspects of the WordPress setup. It is quite evident that it’s not just a great platform, but it also has an equally vibrant community backing it. In this post/tutorial, I will try to summarize what you need to get your first WordPress site rolling from soup to nuts, esp. if you have some development or webmaster background. And, what I mean by that is you are comfortable with things like installing typical development tools, manipulating basic PHP code or simple database configuration. Lastly, while this post is primarily geared towards developers and webmasters, regular users or at times even WordPress veterans may find something useful as I try to bring in some general development best practices.
Note: As it is well known, WordPress along with it’s overall eco-system has a huge set of capabilities, there are at times different ways of accomplishing the same results. This post covers what I figured out over past few months and hopefully it is useful to you. But, certainly do not be limited by what I cover here. As WordPress is continuously evolving, you may find better ways. And, if you do come across something, please feel free to share in the comments.
First things first: Identify your website goals
It is business 101. Identify what are you trying to accomplish with the site? Even if you are just setting it up for fun, put down a few goals. And, I’ll tell you why this is so important.
- If you’ve played with WordPress even a little bit, it’s plugins and themes, you perhaps already know that it’s like an ocean out there. So, unless you know what type of things you want to accomplish, it is very easy to get lost.
- Identifying a few key goals will help you get started. Remember, you don’t need to have everything in your website on day one. Start simple and evolve over time.
With that in mind, following were 2 personas I had for cloudnineapps.com:
- Users: The website users.
- Admins: The website administrators.
Goals
And, following were the key goals.
- Users
- A simple site with a clean look and easy navigation. I had no intent to have anything flashy or animated interactions.
- Self-registration and Membership Management for users so that they can subscribe to the products and services, participate in communities, etc.
- Opt-in/Opt-out newsletter sign up support.
- An ability to search the site content.
- Typical site pages: Like “Contact Us” and “Feedback”.
- Admin
- Manage Blogs
- Manage Products
- Manage Courses
As you can see, nothing very fancy here. Now, lets get into how did I go about the setup.
Development Site Setup
Being a developer, I decided to roll my sleeves and get a development site setup on my laptop. Following are the details of my development environment.
- PHP 7.1 (link)
- Apache (link) – I reused my existing Apache installation
- MySQL (link) – I reused my existing MySQL installation
- phpMyAdmin (link) – Not a must, but highly recommended
- WordPress (link)
Tip: Even though we are starting here with the Development Site, our goal should be to set it up with configurations, best practices and security similar to what we would do in production. This way you can also test it out before rolling out such changes in production directly.
Apache Setup
I prefer to use VirtualHost as that helps avoid installing multiple apache installations just to keep their configuration and deployment separate. It lets you do all that and it works like a charm as you can host multiple virtualhosts if you run multiple sites. Here’s the VirtualHost configuration I used.
# VirtualHost: cloudnineapps <VirtualHost *> ServerName cloudnineapps ServerAlias *.cloudnineapps DocumentRoot /sites/cloudnineapps/www DirectoryIndex index.php <Directory "/sites/cloudnineapps/www"> Options Indexes FollowSymLinks AllowOverride All Order deny,allow Allow from all Require all granted </Directory> </VirtualHost>
Few tips and tricks to use this.
- Create an entry in the /etc/hosts file for the site.
127.0.0.1 cloudnineapps
Now you can access the website using local browser.
http://cloudnineapps/ - Other entries in VirtualHost specify the root directory for site content and basic permissions.
- I created an .htaccess under DocumentRoot.
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
The admin URL will be: http://cloudnineapps/wp-admin
Database Setup
Since I already had MySQL installed, I simply created a new database for my Development Site.
create database cloudnineapps_wp; create user 'c9dbuser'@'localhost' identified by 'password'; grant all privileges on cloudnineapps_wp.* to 'c9dbuser'@'localhost' identified by 'password'; flush privileges;
Tip: Please use a strong password for database.
WordPress Setup
WordPress Installation
- Extract the content of the wordpress zip and copy the extracted files under the DocumentRoot above.
- Ensure to give write permissions to the user that apache is running as. Example for Mac
sudo chown -R _www:staff /sites/cloudnineapps/www
- You are now ready to launch the WordPress installation by going to the home page.
http://cloudnineapps/
Tip: Specify appropriate title, admin user credentials and email. Again, as a practice, use strong password. - It may take a few minutes to complete the installation. Typically, it’s fairly quick.
WordPress Configuration
WordPress is heavily customizable without writing a single bit of code. Here are the settings that I tweaked for the Development Site.
Category | Setting | Purpose | Value |
---|---|---|---|
Settings->General | WordPress Address | The authoring website. | cloudnineapps.com |
Settings->General | Site Address | The public website. Keep same as the above WordPress Address to avoid CORS. | cloudnineapps.com |
Settings->Reading | Search Engine Visibility | Turn search indexing on/off. | Unchecked (for Development Site) |
Settings->Permalinks | The post URL format. | /%category%/%postname%/ |
WordPress Theme Setup
A WordPress Theme determines the overall layout of your site, the look and feel and many such user interface related aspects. Choosing a WordPress theme is literally like going to a mall where you’ve tons of choices. This could take a few minutes and sometimes even days. I suggest to choose something reasonable because in many cases you can always come back and choose a better theme of your choice. I did so various times. And, I did not notice any data loss or such.
Tip: A good time to finalize your theme would be right after you’ve done the basic setup and testing, but before you prepare a lot of content. This is important as at times, the way theme presents data may lead you to organize or format your content differently.
For my purpose, I found the Best Business Theme to be adequate. You can search and install themes from the admin’s Appearance->Theme option.
WordPress Plugins Setup
A WordPress Plugin provides specific capabilities that could range from simple presentation/formatting to more complex things like e-commerce, course management, etc. Alike theme, choosing the right set of plugins can also be daunting. Often there are multiple plugins that serve same or similar purpose. Contrary to theme, I do recommend spending a bit more time identifying the plugins early on. At least, on the most important ones that you want. Several plugins directly impact the way you would author content. Hence, it is worth taking time on the most important plugins. Here’s the list that I picked. You can search and install plugins from the admin’s Plugins menu.
Plugin | Purpose |
---|---|
Contact Form 7 | A very flexible forms plugin. |
HC Custom WP-Admin URL | Protects WordPress URL by providing a custom slug (instead of the default ‘wp-admin’). |
LearnPress | Provides online course management capabilities. |
MailChimp for WordPress | Provides integration with the popular MailChimp bulk mailer. |
Post Tags and Categories for Pages | Provides categories support for pages. |
TablePress | Provides beautiful tables. |
Ultimate Member | Member registration and self management. |
That’s it! You are now ready to start using your Development Site.
Author… Test… Improve…
You put your heart and soul in getting the site setup. Now it’s time to put content that would interest your target audience. Start simple. Author a few different type of content, such as, a couple blog posts, pages, etc to get a feel. You may also find better theme and plugins along the way. And, that’s why I call it a journey. It’s not the end. It’s the beginning!
Promote to Production
Once you’ve perfected the Development Site to a level where you feel comfortable rolling it out to the public, look for an appropriate hosting provider. At this point, I do not have a strong recommendation. But, look at the popular WordPress tutorial sites. They often provide links to hosting providers with coupons as well. As far as pushing content to production is concerned, I did it using the following steps.
Production Database Setup
- Backup source database (as SQL using phpMyAdmin).
- Replace the references from local site to the target site (e.g., “http://cloudnineapps/” by “https://cloudnineapps.com”).
- Login to cPanel of your hosting provider and launch phpMyAdmin.
- Drop all tables.
- If changing the table prefix, do the following.
- Update all the wp_* tables to use table_prefix.
- Update the names of the following to use the table_prefix in wp-config.php instead of wp_.
- <table_prefix>_usermetdata
- wp_capabilities
- wp_user_level
- wp_dashboard_quick_press_last_post_id
- wp_user-settings
- wp_user-settings-time
- <table_prefix>_options
- wp_user_roles
- <table_prefix>_usermetdata
- Import above updated SQL.
- Update the following rows in the <table_prefix>_options table to use the correct site URL.
- siteurl
- home
Production WordPress Content Promotion
Once the production has WordPress installed, do the following.
- Copy the wordpress folder (except .htaccess and wp-config.php).
- wp-config.php updates
- Ensure the DB_NAME, DB_USER, DB_PASSWORD and DB_HOST point to the correct database info.
- If changing table prefix, ensure to update the table_prefix.
- Enable HTTPS.
And, let your WordPress journey begin.
Good luck!
– Nitin