Create a WordPress Sandbox on Your PC

How to install WordPress on your PC or Mac

When you develop a web site it is often more convenient to work on a local computer.

A) Install the Apache Server MAMP

B) Install WordPress on MAMP

Set up WordPress on localhost

In order to run WordPress needs a server environment with PHP and a MySQL database. Here you have several options. Whether you prefer one or the other does not matter much. Here are a few options, choose one of them:

After installing the localhost, you can install WordPress on your local machine. Follow these instructions. If you prefer to follow a video tutorial, here is one more:

Test content

Of course you could write a lot of test content, just to see how every HTML element, any image or whatever works. A better alternative is this: use the WordPress test unit. Here you download test pages, posts and images – and then you will be able to inspect whether everything works as it should.

The Theme Unit Test consist of a xml file with posts, pages, images and so on. You can import them via Tools > Import. You may have to add a plugin in order to import.

In fact this option is very practical. You can import and export content from a localhost to your online WordPress when everything is ready. But first you should try out some themes, and see how they behave with the test content.

In the menu section assign the test menu to the menu location. Now you are ready to see your theme in action.

Try out a few themes

As soon as you have the test content you might want to test a few themes. In the Dashboard go to Themes > Appearance and search for new themes. There are thousands of themes out there, so try to find something that looks like the design you want. In my opinion you should go for an open source theme. Not because it’s “free”, but because these themes have a code-base that’s more easy to change. Often the so-called professional themes have a horrible code, and it is meant to be so. If the user is not confused, how could they continue to sell more solutions?

A Few Useful Plugins

When you have found a good theme, you should add a few plugins. Whatever you choose is a matter of taste, but I’d recommend these as a starting point:

  • Jetpack (performance, tweaks, speed and more)
  • Akismet (fight spam)
  • A page builder, like:
    • Elementor
    • Page Builder (Site Origin)
    • Or just use the standard Gutenberg editor (it is better than most people think).
  • For SEO
    • Yoast
    • The SEO Framework
  • Security
    • WP Limit Login Attempts
  • Webshop
    • WooCommerce (very popular solution)

There are thousands of plugins for galleries, portfolios, shops, images and so on.

Create Content

As soon as these things are done, you are ready to create the actual content. When we develop web solutions it is best practise to work with real content, rather than the boring Lorem Ipsum.

In order to avoid confusion do this:

  1. Delete the content from the Theme Unit Test
  2. Create real content:
    1. Pages for static content, such as “About Us”
    2. Posts for the blog posts
  3. Add widgets

Remember to use Categories and Tags. It will improve your SEO and give more power to your menus.

When you create the content, try you can try page builder!

Pagebuilding with Gutenberg

You should try out Gutenberg. It has many of the features, that you expect to find in Elementor and friends. WordPress’ new editor was not popular among developers when it was introduced.

The following tutorial is a fine introduction to Elementor by Adam Preiser. If you like the tutorial you can visit his tutorials on https://www.wpcrafter.com/ .

Pagebuilder: Elementor

Elementor is a pagebuilder plugin. You can drag and drop content elements where you want them. And if you have wireframes, you can imitate a basic wireframe in a few minutes.

From localhost to the Web

When your content is ready for production, you will have to export the content and the theme. The theme is separated from the content – that’s why you must do the export in two steps. But first you’ll have to install WordPress on a server.

Most web hotels have a “WordPress in one Click” option. Just create the WordPress site. Give it a name. And you’re ready to go. The next steps are:

  1. Install the theme (in the same way as you did on the local machine).
  2. Install all the plugins you want to use.

As soon as this is ready, you go to your local machine. Enter the Dashboard > Tools > Export – and export all content.

Now you go to your online version of WordPress and choose import. Remember to check the box with import media files. If you do so the local images will be copied to the online media library.

Now your site is online, and ready for whatever purposes you or your clients may have.

FAQ

Sometimes things work fine, but now and then we run into troubled waters. In this section I have listed some common problems, we see again and again in the multimedia classes.

Problem: you try to install a theme or a plugin, and get a prompt where you are asked to use FTP.
Solution: Check the folder permissions. Make sure, that the server has write and execute permissions in the folders.

Problem: I get a database connection error during WordPress install on MAMP.
Solution: In MAMP the password and user is ‘root’.

Problem: I get a database connection error on XAMPP.
Solution: On Windows the user is root and the password is blank. On Mac the user and password is root.

Problem: XAMPP crashes.
Solution: Use MAMP … 😉

In my experience XAMPP has a steep learning curve, and often errors occur out of the blue.

So if you work on either Mac or Windows I’d recommend MAMP.

Published by Per Thykjaer Jensen

Senior Lecturer at the Multimedia Design and Communication Programme at Aarhus Business College. I teach code and UX. Linux evangelist and WordPress expert. View more posts

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.