This is the correct installer for Scalable WordPress in the Azure portal.

Setting Up Scalable WordPress Installs On Microsoft Azure

Today, Microsoft announced it was creating what it’s calling “a Scalable CMS solution with WordPress.”

In short, it’s a quick installer that

  • spins up an instance of a standard-tier Azure website,
  • adds a MySQL database (and MySQL DB server, if you don’t already have one),
  • creates an Azure Storage container to hold the wp-content folder (and allows you to create an Azure Storage account if you don’t have one)
  • puts a default WordPress install on that site, and
  • adds a special plugin that communicates with the Azure Storage account.

Much of the code I produce for my day job runs on Azure (both IaaS and Websites), and most of my employers’ websites run on WordPress. (None of those sites are hosted on Azure, however.)

Since a lot of my code does something to a WordPress site, and most of the code I write runs on Azure, you can imagine my joy at having a quick and easy way to spin up and manage WordPress test installs on Azure.

So I went ahead and set up an instance. Here’s a walkthrough, as well as my experience.

Continue reading

Patrons at Mathew's Pub in Portland, ME on April 4, 2014. © Ben McCanna via Flickr. All rights reserved, used by permission.

How To: Use Transients To Speed Up WordPress Templates

Background on how caching works in WordPress, and when it makes sense to use transients, is in the introduction to this post, Using WordPress Transients To Speed Up Your PHP-Heavy Templates: Introduction.

WordPress transients are a simple way to store markup in the WordPress database for short periods of time.

In effect, transients are a kind of mini-cache. They allow us to store finished markup, generated by a template, that’s computationally expensive to create — such as a custom WP Query.

“Transients” are called that because they eventually expire. When some period of time is up (or we intentionally replace or expire the transient), WordPress can rebuild that transient and store it again for some period of time.

This has the net effect of speeding up page load times. Rather than the template having to repeatedly crunch the same code, over and over, to produce the same chunk of markup, the webserver does it once — and serves up that saved markup to all subsequent users.

That’s a lot easier on the server, so it makes pages load faster and reduces errors that can be created when a webserver is under stress.

Continue reading

Dusk over the highway

Using WordPress Transients To Speed Up Your PHP-Heavy Templates: Introduction

This post serves as background to the post, “How To: Use Transients To Speed Up WordPress Templates.”

WordPress is a powerful content management system, and over the years its ability to render very complex data in pleasing, human- and machine-readable formats has been greatly improved.

Thanks to changes in the taxonomy model, as well as improvements in the core functions that surround templates / themes, a designer doesn’t run into nearly as many cases these days of having to run lots of PHP code in a template file.

Even so, sometimes you just can’t avoid having to use a template file to run a complex WP Query, or otherwise put together a bunch of PHP to get something onto your WordPress-based site.

As you’ve no doubt discovered, depending on how code-heavy your template proves, and what resources your Web server has, this can lead to very long processing times, meaning very slow page loads.

Worse, on-template PHP code often can’t be cached, especially if it isn’t centered around a single post / page or a particular taxonomy term.

Continue reading

Beach To Beacon 10K finish line by Ben McCanna. All rights reserved, used by permission.

Make Your First WordPress Plugin: A WordCamp Maine 2014 Presentation

This post is a companion to my WordCamp Maine 2014 talk, “Make Your First WordPress Plugin.”

It’s effectively a recap of an earlier post, Making A Simple WordPress Plugin, with elements from Hooking WordPress Taxonomy Changes With The Plugins API.

If you know how to make, or hack, a WordPress theme, you have all the skills you need to write a plugin.

All it takes is a little knowledge of how to write PHP, a basic understanding of how WordPress goes about making Web pages, and a little trial and error. Oh, and the same, basic tools you use to make any website:

A decent text editor is the only “must have.”

For Macintosh, TextWrangler will work fine; I prefer its full-featured sibling, BBEdit. Protip: Download these directly from BareBones; the Apple Store versions don’t support all features and can make upgrading difficult.

For PC, I use Notepad++; others swear by Sublime Text.

A Web development IDE, such as Dreamweaver, WebMatrix or even Visual Studio will work, too; although these tools, in their zeal to make things easier, can significantly complicate writing plugin code.

Regardless of whether you use a Mac or PC, don’t use the built-in text editors (TextEdit and Notepad, respectively); they tend to introduce file encoding that can prove problematic when trying to write plugins.

Optionally, it’s good to have an FTP program. While this isn’t strictly necessary, it makes salvaging a plugin installation that has gone horribly wrong a lot easier. If you’re an OS guru you can, of course, just use your Web browser for FTP, or maybe install an FTP plugin; but I prefer to use FileZilla on PC and Transmit on Mac.
Continue reading

These are the properties of a WordPress post. Source: WordPress Codex, XML-RPC WordPress API/Posts

Using The WordPress XML-RPC API With PHP: The Post Model’s Properties

Part 4 in a series on working with the WordPress XML-RPC API with PHP.

Previously I discussed the reasons for creating a data model (aka a class), that looks like a WordPress post, in order to streamline and simplify working with the WordPress XML-RPC API.

In this post, we’ll create the properties, or data, that goes into that model. This will help us make heads and tails out of what we need to send to the XML-RPC API, and what we’ll get back, when working with posts.
Continue reading