Durch­dachtes Webdesign & ziel­gerichtete Online Marketing Strategien
Moderne Websites & starke SEO Optimierung
Flexible Gestaltungs­möglich­keiten & schnelle Umsetzung
Hohe Kunden­zufriedenheit & höchste Service­orientierung
bFlow ist Ihr Partner für professionelle Web & Online Marketing Projekte
Durch­dachtes Webdesign & ziel­gerichtete Online Marketing Strategien
Moderne Websites & starke SEO Optimierung
Flexible Gestaltungs­möglich­keiten & schnelle Umsetzung
Hohe Kunden­zufriedenheit & höchste Service­orientierung
bFlow ist Ihr Partner für professionelle Web & Online Marketing Projekte

Sublime Text für WordPress einstellen

Facebook
Twitter
LinkedIn

Setting Up Sublime Text for WordPress Development

Sublime Text has been my text editor of choice for some time now. It boasts a simple yet powerful user interface,  plentiful customization options and a snappy performance to boot.

These features alone make Sublime Text an ideal candidate for WordPress development. Though much like WordPress, Sublime Text’s true power is unlocked when combined with 3rd party extensions or “packages”.

Installing Package Control

Package Control is the engine that powers the installation and management of community packages. Think of it as the WordPress.org equivalent of the plugin and theme repository.

Package Control is not natively included in Sublime Text but is easy enough to install. To install Package Control simply follow the instructions as detailed on the official website.

My Recommended Packages

Below you’ll find a list of my recommended packages for WordPress theme and plugin development.

Package Installation

Package Control is driven by the Command Palette. To install a new package:

  1. Press ctrl + shift + p (Win, Linux) or cmd + shift + p (OS X).
  2. In Command Pallete type “Install” and select “Package Control: Install Package”.
  3. Enter the name of the package to install, select from the choices available in the autocomplete list.

Package List

SublimeLinter
An essential package for PHP development. It performs real time scanning on your code using PHP’s native lint mode (i.e. php -l) and reports back if it finds any errors.

This will often save you time as you’ll be able to find and correct common PHP errors such as missing semicolons or braces right inside your code editor.

SublimeLinter also includes support for other programming languages such as JavaScript and functions in a similar vein to the PHP linter.

WordPress
This package is extremely helpful for WordPress development as it provides autocomplete functionality for many of the thousand WordPress functions, hooks, constants and classes.

WordPress Developer Resources
This package adds a tool that allows you to search the new WordPress Developer Resources (developer.wordpress.org) or WordPress Codex (legacy) directly from Sublime Text. The tool can be access via a context menu (right click menu),  tools menu or via the Command Palette.

DocBlockr
This package simplifies the process of creating and managing documentation for your code. DocBlockr supports both PHP and JavaScript and shows a completion list for all tags supported by PHPDoc, JSDoc and others.

Sass
Sublime Text lacks native support for Sass (Syntactically Awesome Style Sheets). If you decide to use Sass in your theme and plugins you’ll definitely want to install this package for overall better Sass support.

PHP Code Sniffer
This package helps you to comply to WordPress coding standards by highlighting non standards compliant code and suggesting appropriate fixes. For WordPress specific coding standards you’ll need to install theWordPress coding standards rules. Also see this handy configuration filefor an example of how to get this up and running on Windows machines.

Bonus

Trim Whitespace Automatically

Another way to keep your code clean is to ensure it’s free of unnecessary trailing whitespace. To do so simply follow the steps below:

  1. Select “Preferences” from the main menu.
  2. Select “Settings – User” from the drop down menu.
  3. A JSON config file will open.
  4. Add the following to the end of the file before the closing curly brace.
"trim_trailing_white_space_on_save": true

Unnecessary trailing whitespace will now be automatically trimmed every time your file is saved.

Ensuring Files End With An Empty Line

While not included in the official WordPress PHP coding standards document it is recommended by the PSR-2 Coding Style Guide that all PHP files MUST end with a single blank line.

To comply with this guideline simply follow the steps below:

  1. Select “Preferences” from the main menu.
  2. Select “Settings – User” from the drop down menu.
  3. A JSON config file will open.
  4. Add the following to the end of the file before the closing curly brace.
"ensure_newline_at_eof_on_save": true

This will ensure that newlines are present at the end of your files each time they are saved.

War dieser Artikel hilfreich?
Scroll to Top