Available tools to run a local site on your computer:
- Local by Flywheel
- Studio by WordPress.com
- WordPress Playground
- XAMPP Installers and Downloads for Apache Friends
- Docker: Accelerated Container Application Development
- MAMP & MAMP PRO
Transcript
Introduction
In this lesson, we will explore the reasons why you should run a local site. A local environment is crucial for building, testing, and experimenting with your website safely and efficiently. In this lesson, we will define a local testing environment, identify the benefits of using a local environment, and explore three options for setting up a development site. But what is a local testing environment? A local testing environment is a setup on your computer that mirrors your live website but runs entirely offline. It acts as a buffer between your live site and the changes you’re working on. It allows you to create, test, and refine websites without needing a live hosting service or risking your main website. It is like a test zone, where you can work freely and make changes without any cost or risk to your live site.
Benefits
What are the benefits of using a local environment? Number one, it costs nothing; you can use it for free. Secondly, you can use it to experiment. You can build your site in a safe environment before uploading it to a web host or test changes without affecting your live website. Number three, it allows you to have a backup plan. If you encounter issues on your live site, having a local copy means you can quickly revert to a previous stable version, minimizing downtime. Fourthly, it can be a learning space. You can practice your WordPress skills in a risk-free environment.
Tools
Setting up a local WordPress site can be simplified by using tools such as Local by Flywheel, WordPress Studio, and WordPress Playground. You can also explore other options, such as XAMPP, Docker, or MAMP.
Local
Let’s start by looking at Local. The first step is to download and install Local. Visit Local’s website to download and install the tool for your operating system. Install it like any other application. Once you have installed the application, click “Create local site” at the bottom left. Then, you will have three options—number one, to create a new site. Number two is to create a site from a blueprint. Number three is to select an existing zip to import a site. We will go ahead and create a new site. Then, you can add your site’s name and configure your environment. We can choose Preferred, and If you choose Custom, you can select the relevant PHP version, web server, and database. For this example, we can select Preferred and then Continue. The last step is to select a username, password, and email. Then we can add our site.
Once your site is ready, click WP Admin and start building, exploring, or testing. Remember, you can use a migration plugin to export this site onto a production site or import a different site onto your test website. Another cool feature to highlight is that you can enable a live link. If you are signed in, you can enable a live link for others. Once enabled, you can share the link and login details with collaborators.
Studio
Studio is another local environment worth using, a quick, lightweight, and shareable local WordPress development environment. After downloading and installing Studio, you can set up a new site. To create a new site, click Add Site at the bottom left, name it appropriately, and select a directory path for its files. And then click on Add Site. Below Customize, you can easily access the Site Editor, Patterns, Navigation, and other areas. So I will go ahead and open the Site Editor and now I will be able to achieve the same outcome as with Local. I can test my skills, explore new features, import a site onto my test site, or export my test site to a production site.
WordPress Playground
The last option is a different approach using WordPress Playground. WordPress Playground is a browser-based tool that allows you to run WordPress directly on your web browser, eliminating the need to install software. It is a platform that lets you run WordPress instantly on any device without a host. It creates temporary environments that are discarded after use. It’s a place to build, experiment and test. You can start using Playground instantly by navigating to playground.wordpress.net in your browser. Or you can customize your setup by using the query API in the URL by adding ?networking=yes after ‘.net.’ This will allow you to install and activate plugins and themes.
You may decide to build your site from scratch, and then, when you select the hamburger menu, you can download the site as a zip and export it to your production site. Or, if you want to import a site, click on Restore from zip, which will allow you to replace the current WordPress Playground site with a previously exported one. You can also tweak the URL to automatically install specific plugins or themes on your site.
To automatically install and activate a plugin, for example, you add ?plugin= and then followed by the plugin slug. Let’s go ahead and install the WooCommerce plugin. The plugin slug is the last part of the plugin’s WordPress.org URL. Let’s visit WooCommerce and double-check that we’ve used the correct slug. Then, we can return to Playground, and when we hit Enter, the plugin will automatically install and activate. Now you can test and explore using the plugin. To automatically install and activate a theme, we write ?theme= and then the theme slug. In this case, ‘twentytwentythree.’ Then, it will be ready to use in a few seconds. You can also install multiple plugins and themes simultaneously by adding the & sign between the slugs. So, in this example, you will notice that I’ve added the Twenty Twenty-Three theme, the WooCommerce plugin, and the Contact Form 7 plugin.
By default, changes made in Playground are temporary and will be lost once you close the tab. To make changes persistent, use the settings button in the Playground interface to enable browser storage. This allows your changes to be saved even after refreshing the page. As we will see, the ability to store your site locally on your device is still in beta. Finally, it is also worth mentioning that you can quickly load a language pack to WordPress Playground via the URL. Merely type ?language= and then the WordPress Locale Code—for example, es_ES for Spanish in Spain. Then, the test website will load in the language you selected.
Conclusion
Utilizing a local testing environment is essential for various WordPress tasks, such as building a site before hosting it, experimenting with new themes and plugins, troubleshooting issues, or honing your WordPress skills.