This post is the first of a series of posts on how to dive into WordPress theme development.
Going from developing simple HTML/CSS sites to using a Content Management System is a very big step. You will save a lot of time by having your CMS handle all the content on your site. To ensure you are on the right track from the start, there are a few things you should understand:
- Installing WP on localhost
Using localhost for your development environment is great because you don’t need to waste time uploading files via FTP and your site won’t be live for people to find while you are working on it.
Install Guide for Windows
Install Guide for MacNote: If you have troubles with custom permalinks using WAMP, click on the WAMPSERVER icon in your toolbar, and hover over “Apache” > “Apache modules” and make sure “rewrite_module” has a checkmark next to it. If it doesn’t, click it.
It’s a good practice to keep your localhost install matching your production site, then when plugin/theme/WordPress updates are available, you can test them on localhost before updating them on your live site.
(Another great thing is that you can work on your site without Internet access. Take that crappy coffee shop WiFi!) - Debugging in WordPress
Turn debugging on in WordPress so you will know when you have PHP Errors, Warnings, and Notices. A key part of this is also knowing the difference between Errors, Warnings, and Notices.
Debugging can be turned on by placing the following PHP in your wp-config.php file before the line that says:
/* That’s all, stop editing! Happy blogging. */define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DIPLAY', true ); // Set to false on production sites. define( 'WP_DEBUG_LOG', true ); // Any errors will be saved in wp-content/debug.log
Note: You should only have WP_DEBUG_DISPLAY set to “true” on development sites, because it poses security issues as the errors will contain the file paths. Additionally, the error messages can affect the appearance of your site, so it’s sometimes easier to just use WP_DEBUG_LOG.
- Theme Check, Plugin Check, & P3 Profiler
Use these three plugins to discover potential issues with your themes and plugins:
Theme Check
Plugin Check
P3 (Plugin Performance Profiler)
In my next post on theme development, I’ll go over the required files and structure for Themes and Child Themes.