Category Archives: Tutorial

Howto Setup PhpStorm to Work on WordPress Plugins (and Themes)

PhpStorm is the best PHP IDE available and you should use it. If you don’t agree stop reading. Did you stop reading? No? Good, then you aren’t a dumbass let’s get started.

This tutorial explains how to setup PhpStorm to work on WordPress Plugins (and Themes).

Target audience: Intermediate to advanced.

UPDATE (2014-03-21): PhpStorm 8 (and up) supports WordPress development out of the box. Check it out!

This tutorial will not show you how to use PhpStorm. I assume you are already using PhpStorm or want to learn and will do so on your own. This tutorial will not show you how to develop for WordPress. Yes, WP sucks and is ass-backwards PHP. Or yes, WP is amazing and powers ~20% of the web. For whatever reasons, you are here for this info.

Benefits of this type setup:

  • Automatic code completion, code navigation, PhpStorm’s kitchen sink.
  • Ability to mix version control systems (Git, SVN, Perforce, CVS, …)  and sources (GitHub, SourceForge, Codebase,, … )
  • Work on multiple plugins (and themes) at the same time for the same project.

I’m a developer at This is my project setup:


This structure makes up the bulk of PressBooks dot com, that is:

  • WordPress 3.5.x (Subversion)
  • PressBooks (GitHub)
  • The front page of PressBooks dot com (a private theme, hosted at Codebase)
  • Internal stats dashboard (a private plugin, hosted at Codebase)


  • LAMP on localhost or LAMP on VM with mapped folders. (If this doesn’t mean anything to you then stop reading and come back when it does, young padawan)
  • PhpStorm -> Quick Start -> Open Directory
  • PhpStorm -> File -> Settings



Under Project Settings, select Directories. Add each content root that makes up your WordPress project.



Under Project Settings, select Deployment. Click the green +. Create a deployment profile of type “Local or Mounted Folder”. I named mine: TextoPress. Rename accordingly. Remember this renaming for the Install section that will come later. Select the Connection tab. Change “Folder” to: the root path of your WordPress site. Change “Web server root URL” to: the root URL of your WordPress site.

wordpress-and-phpstorm-deployment-2Select the Mappings tab.

  • Map WordPress to: /
  • Map Plugins to: wp-content/plugins/__PLUGIN_NAME__
  • Map Themes to : wp-content/themes/__THEME_NAME__

Replace __PLUGIN_NAME__ and __THEME_NAME__ accordingly. Click on the above screenshot and squint for more details.

wordpress-and-phpstorm-deployment-3Under Project Settings, select Deployment -> Options. Change “Upload changed files automatically to the default server” to: Always. Change “Upload external changes” to: true.

Version Control


Under Project Settings, select Version Control. Add your VCS repositories.


Apply changes. Right click on your project. Select “Upload to TextoPress” (Don’t see TextoPress? Exactly. Re-read the Deployment section above…)  Navigate to your web server root URL. Install WordPress using the Famous 5-Minute Install. Eventually:



  • You are editing a copy of the code, not the deployed code. If something seems weird always start by doing “Upload to TextoPress” which from here on in will be known as “Did you plug it in?”
  • You can add and remove plugins (and themes) as you feel like. Rinse and repeat the instructions above until you get the hang of it.

Code is poetry. Bad, wince-worthy poetry.

Behavioural Advertising, Privacy, And You

The internet is no longer a document repository. It is a trend tracking device that predicts group behaviour, pays out royalties, and fine tunes information delivery mechanisms to maximize profits, at the expense of your privacy.

Behavioural advertising is all the rage and it creeps people out.

Walden Two, written in 1948 by B.F. Skinner I.e. the father of radical behaviourism, paints a picture of a society where all human problems are solved by a technology of behaviour.

Ok, so let’s make some parallels  I mean, why not have another go at wildly unpopular and mostly discredited books from the past? These types of ideas are right up my alley alongside communism, the leisure society, or the abolition of work. What follows is incoherent rambling that tries to be a tutorial on how to setup your web browser so that internet marketers can spy on you for the greater good.

If you are late to the party then you should know that this is already happening. Your internet activities are constantly being aggregated into private databases, then analysed to find new and improved ways to part you from your money (or worse). This is real life.

A technology of behaviour, as told in Walden Two, should reinforce the person you want to be and reinforce the values of a society you want to live in.

In contrast, the advertiser, on behalf of their customer, wants to sell you on whatever unethical shit they possibly can using the most slimeball techniques at their disposal.

Now that we’ve established a totally reasonable angry loner black and white dichotomy with no overlapping shades of gray /sarcasm, what’s next?

On the internet it’s the advertiser that controls this technology, not you. The advertiser is the middleman between the things you care about (content) and the dollars that support those things.

Here’s how I run things. This my very own two-step compromise, selector:

#1 – Disable third-party cookies in Chrome.

When I visit Google or Amazon and they want to set their own cookies, I agree. The metaphor is when I’m in your store I can be convinced to buy your cookies. When I’m in another store…  Wait, why are you following me around? Why would anyone agree to this? Keep your tentacles out of other vendors’ cookie jars.

#2 – Use Ghostery to block everything indiscriminately, but whitelist the sites I support.

I want to reinforce myself with content that makes me a better person. If an advertiser uses a technology of behaviour on this type of content, I agree. If that same advertiser tracks me in my weaker moments, like when I’m in tabloid mode trolling for garbage, I don’t want this added to my behaviour profile. I don’t want to reinforce negative behaviour. Just because some content exists doesn’t mean I think it should thrive.

Tada! We now live in a Walden Two inspired utopia. Easy! Wait, no…

Some people argue that blocking ads is evil, that tracking technology is like watching ads on TV, and it’s simply how content gets funded. I disagree. When I’m watching TV on channel 1, I don’t get served advertisements from channel 2 and 3 while channel 4 spies on me. I opt-out by changing the channel.

In fact, I would argue that TV as we know it doesn’t exist anymore:

For the impatient, Tim O’Reilly gets into TV paradigms at around 15 minutes. He makes the case that providers such as Comcast pay for TV content but do not pay for Internet content. Wealth distribution gets intresting at 16:20 where O’Reilly reveals that a major pop star makes more money on YouTube than on iTunes. More than half the money comes from fan videos. A fan uses a tune, Google tracks that, then forwards money to the music companies.

In the old economy an uncleared song broadcast to millions was a blatant copyright violation; In the new economy it’s more money?

Ironically, Chrome and Ghostery, the tools I use to block advertisers, are in the advertising businesses. Chrome is made by Google. In 2011, 96% of Google’s 37.9 billion dollars came from advertising. Ghostery is owned by Evidon. They used to be called The Better Advertising Project. How they make money is anyone’s guess but giant red flags make it safe to say it’s not anti-advertising.

Welcome to a new era where conflict of interest creates new money and creative ways to extract it, not appolegetics, run the gamut.

Behavioural advertising is a public one way street. Privacy and public anonymity are not the same thing. I know this. I knowingly disclose behavioural patterns in a social web to a network of unknown super computers and their operators. I don’t know what they are doing with this information. Privacy policies are ambiguous and, to me, they always sound something like: “We have a bunch of naked pictures of you. Don’t worry, we’ll never show them to anybody. We only count them with everyone else’s naked pictures, that we also have, for stats and stuff. Trust us, we’re cool.” From a privacy standpoint selective ad-blocking simply isn’t enough. The evercookie proved that cookies are not the only way to track a web browser. Nefarious entities with other tracking technologies are out there. My approach is knowingly naive. “I’m a vegetarian I eat fish and meat on occasion.” It’s hypocritical, incoherent, and lazy compared to veganism but I still do it. You should too?

I strongly suggest checking out this talk: Jacob Appelbaum & Dmytri Kleiner: Resisting the Surveillance State and its Network Effects. Big brother is watching you, on sale at 50% off!