Writing vs. Programming

I just saw on twitter a time lapsed video of the author Scott Berkun writing 1000 words:

While watching it, I was amazed at how much it resembles the way I program.

In spite of the resemblance, I tend to think writing is harder, because there’s no computer to tell you if what you wrote works or not.

In both cases you can ask other people to review your work, sure, but there’s no comparable tool for writing that could match the speed of a web page reload or even of a compiler.

I should write more.

Advanced Metadata Queries

WordPress 3.1 will come with powerful taxonomy querying capabilities.

It will also have comparable capabilities for querying posts based on various custom fields.

Scenario

You have a ‘product’ custom post type with ‘price’ and ‘description’ custom fields.

Before

Here is the most advanced meta query that you could do out of the box, before WP 3.1:

Get all the products with a price greater than 100:

query_posts( array(
  'post_type' => 'product',
  'meta_key' => 'price',
  'meta_value' => 100,
  'meta_compare' => '>'
) );

After

Here is what you can do now:

Get all the products with a price between 100 and 200 and a description that doesn’t contain the string ’round’:

query_posts( array(
	'post_type' => 'product',
	'meta_query' => array(
		array(
			'key' => 'price',
			'value' => array( 100, 200 ),
			'compare' => 'BETWEEN',
			'type' => 'numeric',
		),
		array(
			'key' => 'description',
			'value' => 'round',
			'compare' => 'NOT LIKE'
		)
	)
) );

A breakdown of the enhancements:

  • more than one meta query possible (#14645)
  • several new ‘compare’ values: ‘LIKE’, ‘NOT LIKE’, ‘IN’, ‘NOT IN’, ‘BETWEEN’, ‘NOT BETWEEN’
  • ‘type’ parameter

A complete reference can be found in the Codex: WP_Query#Custom_Field_Parameters

Having read this, please don’t use custom fields as taxonomies.

Front-end Editor: Version 1.9.2

Thought I’d do another release before year’s end. It is focused on improving the existing features rather than adding new stuff.

The tooltip looks sexier now. It resembles the one on the iPhone:

tooltip

When you click a link inside the rich editor, a gmail-like tooltip will appear:

link tooltip

Another usability improvement is limiting the maximum height of the wysiwyg editor to the window height, so that the controls are always visible. This way, you don’t have to constantly scroll up and down from the text you’re editing.

For developers: I’ve moved plugin development to github:

https://github.com/scribu/wp-front-end-editor