Choosing a Video Format for the Web

Nettuts+ has a good article detailing the current state of the various video codecs supported by desktop and mobile browsers. Basically, there’s still no single format with universal support; Flash is still the best option for the desktop, and H.264 is the only option for mobile devices. In the future browsers will natively support HTML5’s […]

Continue reading...

Determining WordPress Paths and URLs

I often need to include a directory or URL path when writing a theme or plugin, but I can never find all of the different options in one place, so I’m pulling it together from various Codex pages and xref. Constants ABSPATH – /var/www/vhosts/example.com/httpdocs/ WP_CONTENT_DIR – /var/www/vhosts/example.com/httpdocs/wp-content WP_CONTENT_URL – http://www.example.com/wp-content WP_PLUGIN_DIR – /var/www/vhosts/example.com/httpdocs/wp-content/plugins WP_PLUGIN_URL – http://www.example.com/wp-content/plugins TEMPLATEPATH – /var/www/vhosts/example.com/httpdocs/wp-content/themes/parent-theme STYLESHEETPATH – /var/www/vhosts/example.com/httpdocs/wp-content/themes/child-theme […]

Continue reading...

Using Chained Properties Inside $wpdb->prepare()

If you’re using $wpdb->prepare() to query a custom table, you can’t pass the table name in as an argument because it will be single-quoted, which would be a MySQL syntax error. Instead, you need to insert the variable directly into the double-quoted query string and let PHP parse it out. That creates a new problem, […]

Continue reading...

Capturing WordPress Plugin Activation Errors

If you’re developing a plugin and there are any PHP errors/warnings you’ll get a message like this when you activate it: The plugin generated [x] characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin. You don’t actually see […]

Continue reading...