Topics
- Other WordPress Development Tools
Why set up a development environment? Why set up a development environment?
Xcode is the primary tool for macOS and iOS development and it is only available on the Mac. It is a free download from the Mac App Store and the current version is 11.5 the time of writing. Local Development Environment Setup For Mac 9,9/10 3521 reviews Setup Local Dev Environment Note The location of the daemon.json file can vary from machine to machine. In this article, I want to talk about how I set up a development environment on Mac OS X. But first, a little bit of background. I’m a freelance software developer and technical writer.
When developing themes, it is best to do it in an environment identical to the production server which will eventually host your WordPress installation. Your development environment can either be local or remote. Configuring a local environment to work on your WordPress theme is beneficial for several reasons:
- You can build your theme locally without relying on a remote server. This speeds up your development process and allows you to see changes instantly in your browser.
- You do not need an Internet connection to build your theme.
- You can test your theme from a variety of perspectives. This is important, especially if you plan on releasing your theme to a larger audience and want to ensure maximum compatibility.
Your WordPress local development environment Your WordPress local development environment
For developing WordPress themes, you need to set up a development environment suited to WordPress. To get started, you will need a local server stack and a text editor. There are a number of options, including:
Local Server Stack
- A local server stack, such as LAMP (Linux Apache MySQL/MariaDB PHP) or WAMP (Windows Apache MySQL/MariaDB PHP) is a server (much like the server that runs on your web server), which you will configure on your local machine. You can install pre-bundled programs that contain all of these, like MAMP (for Mac), or XAMPP (Mac or Windows) to quickly setup your environment.
Virtualized Environment
- A virtualized such created with Vagrant and VirtualBox allows you to create easily reproducible development environments. Varying Vagrant Vagrants (VVV) is a popular Vagrant option which creates a WordPress development environment.
Text Editor
In addition to a local server environment, you also need a text editor to write your code. Your choice of text editor is personal, but remember that a good text editor can speed up your development process. Your text editor can be everything from a basic tool for writing code to a fully integrated development environment (IDE) with tools for debugging and testing. It’s worth doing research, and some even include support for WordPress development. Popular choices are Atom, Sublime Text, and PhpStorm.
You can find a list of tutorials for setting up development environments at the bottom of the page.
Supporting older versions of WordPress Supporting older versions of WordPress
It’s standard practice for WordPress themes to support at least two versions back to ensure a minimum of backward compatibility. For example, if the current version of WordPress is at 4.6, then you should also make sure that your theme works well in versions 4.5 and 4.4 as well.
You can refer to the WordPress Releases page to access older versions of WordPress. Then you can download and install older WordPress versions, creating multiple development sites, each running different WordPress versions for testing.
WP_DEBUG WP_DEBUG
Configuring debugging is an essential part of WordPress theme development. WordPress provides a number of constants to support your debugging efforts. These includes:
WP_DEBUG
The WP_DEBUG PHP constant is used to trigger the built-in “debug” mode on your WordPress installation. This allows you to view errors in your theme. To enable it:
1. Open your WordPress installation’s wp-config.php file
2. Change:
to
WP_DEBUG_DISPLAY and WP_DEBUG_LOG
WP_DEBUG_LOG and WP_DEBUG_DISPLAY are additional PHP constants which extend WP_DEBUG.
WP_DEBUG_LOG is used in conjunction with WP_DEBUG to log all error messages to a debug.log within your WordPress /wp-content/ directory. To enable this functionality set WP_DEBUG_LOG to true within your wp-config.php file.
WP_DEBUG_DISPLAY is used to control whether debug messages display within the HTML of your theme pages. To display error messages on the screen as they occur, configure this setting to ‘true’ within your wp-config.php file.
With the WP_DEBUG and WP_DEBUG_DISPLAY enabled, error messages will display at the top of your site pages.
Note: Errors will display in the frontend and admin areas of your site. These debug tools are meant for local testing and staging installs, not for live sites.
Other WordPress Development Tools Other WordPress Development Tools
In addition to WP_DEBUG, the following plugins and unit test data sets are an important part of your development toolset and help you develop better WordPress themes.
Test DataTest Data
WordPress.org Theme Unit Test Data
WordPress.org Theme Unit Test Data is an XML file containing dummy test data that you can upload to test how themes perform with different types and layouts of content.
WordPress.com Theme Unit Test Data
WordPress.com Theme Unit Test Data is dummy test data that you can upload to a WordPress installation to test your theme, including WordPress.com-specific features.
PluginsPlugins
Debug Bar(WordPress plugin)
Debug Bar adds an admin bar to your WordPress admin providing a central location for debugging.
Query Monitor(WordPress plugin)
Query Monitor allows debugging of database queries, API request and AJAX called used to generate theme pages and theme functionality.
Log Deprecated Notices(WordPress plugin)
Log Deprecated Notices logs incorrect function usage and the use of deprecated files and functions in your WordPress theme.
Monster Widgets(WordPress plugin)
Monster Widget consolidates the core WordPress widgets into a single widget allowing you to test widgets styling and functionality in your theme.
Developer (WordPress plugin)
Developer helps optimize your development environment by allowing easy installation of tools and plugins that help in troubleshooting and ensuring code quality.
Theme-Check (WordPress plugin)
Theme-Checktests your theme for compliance with the latest WordPress standards and practices.
WordPress Theme Review Guidelines WordPress Theme Review Guidelines
In addition to the above development tools, it’s a good idea to stay up to date on the WordPress.org Theme Review Team’s Guidelines for theme submission and guidance on meeting WordPress Coding Standards. These guidelines are the “gold standard” for quality theme development and are useful, even if you don’t plan on releasing a theme on WordPress.org.
Further Resources Further Resources
- Developing WordPress Locally With MAMP (Mac, MAMP)
- How to Setup a WordPress Development Environment for Windows (Windows, XAMPP)
- WordPress Theme Review VVV: A Quick Vagrant Setup for Testing Themes (Cross-platform, Vagrant)
- Setting up your Development Environment (WordPress.com VIP)
- wptest.io – an exhaustive set of WordPress test data derived from WordPress’ Theme Unit Test
The Xcode IDE is at the center of the Apple development experience. Tightly integrated with the Cocoa and Cocoa Touch frameworks, Xcode is an incredibly productive environment for building apps for Mac, iPhone, iPad, Apple Watch, and Apple TV.
Xcode smoothly takes you from concept, to code, to customers.
Because everything is so well integrated, workflows feel natural. As you compose a new interface, the Assistant editor intuitively presents the related source code in a split window pane. Simply drag the mouse to connect UI controls to the implementation code. Apple LLVM compiler technologies parse your code, keeping every symbol you see in the LLDB debugger consistent with the editor and compiler. As you type, that same engine is constantly at work, finding mistakes and offering Fix-its for your code.
Xcode even communicates with the Apple developer website, so you can enable services such as Game Center or Passbook in your app with a single click. When your app is ready, Xcode will bundle and submit your app to the App Store.
Assistant Editor
The Assistant button splits the Xcode editor in two, with your primary work document on the left and an intelligent Assistant editor pane to the right. The Assistant editor automatically displays files that Xcode determines are most helpful to you based on the work you are performing in the primary editor. For instance, if you are editing MyClass.m in the primary editor, the Assistant will automatically show the counterpart MyClass.h.
Jump Bar
Clicking the Jump Bar, located at the top of every editor pane, you can quickly select what information to view in the Assistant editor. For instance, while editing source code in the primary editor, the Assistant can show the counterpart header, sub-classes or superclasses, or related tests.
Interface Builder
Fully integrated within the Xcode IDE, the Interface Builder design canvas makes it simple to prototype a full user interface without writing any code. Prototype in minutes, then graphically connect your interface to the source within the Xcode editor, laying out windows, buttons, and sliders to create a functioning Mac, iPhone, or iPad user interface. With the Assistant editor, you can work on the graphical design side-by-side with the implementation source code. A simple mouse drag from a UI control to the source pane creates a connection between code and interface, and can even create the code stub for you.Learn more
The Version editor makes it easy to compare two versions of a file, see commit logs, check who made a code change, and even zoom back through the commit timeline. The Version editor splits the pane to show two different versions of the same file. Differences are highlighted as you travel through the timeline separating the editor views. Xcode can also create a local Git repository for new projects, or check out a hosted Subversion or Git repo. The top-level Source Control menu makes it easy to perform branch and merge operations, perfect for distributed teams.
Testing
Test-driven development is a first-class workflow within Xcode. The Test Navigator makes it incredibly easy to jump to any test in your project, execute an individual test, or execute a group of tests. The Assistant editor has new test-specific views that automatically track which tests exercise the code you are presently editing, keeping your tests and code in sync at all times.
Customize
The Xcode environment can be configured to match almost any workflow, including customization features like tabs, behaviors, and snippets.
Python Development Environment Mac
Tabs.
Create a completely unique view of your project with tabs. Each tab has its own navigator, editor, assistant, and utility area arrangement. You can name tabs for specific tasks, re-arrange them, or tear out the tab to create a stand-alone window.
Best Development Environment For Mac
Behaviors.
Tell Xcode what to do with events such as starting a debug session or encountering an error during a build. Coupled with tabs, you can create a custom work environment for each of your edit, design, build, or debug tasks. Custom behaviors can also completely re-arrange your window with a single key combination.
Development Environments For Machine Learning
Snippets.
Php Development Environment Mac
Dozens of pre-configured code completions, such as defining a new class or method, are included in the snippets library. By customizing or adding snippets, you can insert frequently entered code by typing only a few characters.
Get quick access to any file your project uses with Open Quickly (Command-Shift-O). Xcode immediately offers completions for your search, allowing you to choose one and hit Return to open the file or hit Option-Return to open in the Assistant editor.
Customize the way Xcode builds and runs your app depending on whether you are debugging, profiling, performing code analysis, or running a test suite. For example, the default scheme is configured to build your app in “Debug” mode when running, and the same scheme settings will build for “Release” when performing the Profile or Archive command. There is no need to change project settings as you move from task to task. Xcode configures the schemes for you automatically, or you can use the “Manage Schemes” menu to customize them yourself.