WordPress Custom Theme and Post Types Permalink Structure

I needed a way to have my theme blog posts all under /blog/ and all custom post types have their slug right off the root of the site.

/blog/
/blog/blog-post-title
/custom-post-type/
/other-custom-post-type/

By default, when I update the permalinks structure in the wp-admin to be /blog/%postname%/ all the custom post types got prepended with /blog/.

To fix this I updated the custom post type options when I register the post type in functions.php to:

'rewrite' => array( 'with_front' => false )

This fixed the issue and now all your permalinks are belong to us.

Documentation: look for the rewrite section

Could not connect to database… old insecure authentication

Error:

Could not connect to database. SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD(‘your_existing_password’). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file

Solution:

run the following SQL to update the password

SET SESSION old_passwords = 0;
SET PASSWORD = PASSWORD('replace_with_correct_password');

Example using Sequel Pro

Bitbucket Status Subscription

I just found out that you can subscribe to a status issue over on http://status.bitbucket.org/ when there are issues! I love it! Talk about convenience for the customer (me). Now I will get a text when the issue is resolved. Kudos to the Atlassian team for doing this.

JavaScript Simple Detect Touch Device

Simple way to detect a touch device is by using a function like

function isTouch() { return ('ontouchstart' in document.documentElement); }