Oakwood Creative is hiring a front end developer!

The company I work for is currently hiring a front end developer. So if you’re located in Stockholm, Sweden or willing to relocate you should definitely check it out!

We have put together a small site for you turn into HTML as a work sample, which could be fun as a night activity!

More info here:
http://oakwood.se/jobb (English version)

Tagged with: , , ,
Posted in Uncategorized

Remove all “missing” files from a SVN working copy

After upgrading a local installation of WordPress subversion started complaining about missing files, that were deleted during the upgrade.

Since there were a lot of files I searched for an easy way to delete all the missing files at once, and found such a way here.

svn rm $( svn status | sed -e '/^!/!d' -e 's/^!//' )

One of the comments mentions that it doesn’t work with filenames that contains white space, which I haven’t tested.


Tagged with: , ,
Posted in Misc

Add your own CSS classes to tinyMCE

The Rich Text Editor (RTE) in WordPress use a JavaScript-library called tinyMCE. It is a widely used library and can be configured in a lot of ways.

WordPress let developers filter the settings to tinyMCE so that it fits your needs.

function mytheme_tiny_mce_before_init($arr){
 $arr['theme_advanced_blockformats'] = 'h2,p,blockquote';
 $arr['theme_advanced_styles'] = 'Leading=leading';

 return $arr;
add_filter( 'tiny_mce_before_init', 'mytheme_tiny_mce_before_init' );

function mytheme_mce_buttons($arr){
 return array('bold', 'italic', '|', 'bullist', 'numlist', '|', 'formatselect', 'styleselect', '|', 'link', 'unlink' );
add_filter( 'mce_buttons', 'mytheme_mce_buttons' );

These few lines of code changes the buttons in the editor, and also adds a format select and a style select.

From the format select you now can select “Heading 2”, “Blockquote” and “Paragraph”. In the style select you can select “Leading” and your element will get the CSS class leading.

Tagged with: , , ,
Posted in Intermediate

Simple “Catch URI” function

This function is vaguely inspired by the function bp_core_set_uri_globals from BuddyPress.

I use it often for more advanced plugins and themes. With it I can check which URL is being viewed and perform actions depending on the url.

function mytheme_catch_uri() {
 $uri = $_SERVER['REQUEST_URI'];
 $uri = str_replace( '?' . $_SERVER['QUERY_STRING'], '', $uri );
 $uri = split( '/', $uri );
 $uri = array_values( array_filter( $uri ) );
add_action( 'init', 'mytheme_catch_uri', 5 );

This functions gives me an array with the pieces of the URL in an array. If I’m viewing /user/vincent the array will look like

Array (
[0] => 'user',
[1] => 'vincent'

With this I can do a lot of fun. For example, do some simple AJAX callbacks if I post to the URL /ajax/get_user/vincent.

function mytheme_catch_uri() {
 $uri = $_SERVER['REQUEST_URI'];
 $uri = str_replace( '?' . $_SERVER['QUERY_STRING'], '', $uri );
 $uri = split( '/', $uri );
 $uri = array_values( array_filter( $uri ) );

if ( isset($uri[0]) && $uri[0] == 'ajax' ) {
$action = $uri[1];
if ( $action =='get_user' ) {
$user = $uri[2];
// Do some more
 add_action( 'init', 'mytheme_catch_uri', 5 );

This is just one examples of all the things you can do!

Tagged with: , ,
Posted in Advanced

Fix sort/order with post_title for international characters

If you want to list your posts and order them by title, that is as simple as:


But if you are using international characters and/or another alphabet the default database settings may mess things up for you.

In Sweden for example, the last the letters in the alphabet are Å, Ä, Ö. So accordingly, posts with titles starting with those letters should come last in an ascending list, but by default ‘Å’ and ‘Ä’ will be considered as ‘A’ and ‘Ö’ as ‘O’ .

But there’s an easy fix for this. Simply change the collation of the post_title column.

Execute the following SQL query. Remember to back up your database before, just to be safe!

ALTER TABLE wp_posts CHANGE post_title post_title TEXT CHARACTER SET utf8 COLLATE utf8_swedish_ci;

This will give your post_title column a Swedish collation, so please change to your desired collation.

Tagged with: , , ,
Posted in Intermediate

Disable password changed/reset e-mail notification

One of the bigger projects I am working on currently has 30k+ users. Having that many users means that many also will reset their password, and you will receive an e-mail every time.

So how do you disable it?

The function sending this e-mail is called wp_password_change_notification and is declared in pluggable.php. The great thing about the functions in pluggable.php is that if you declare a function with the same name as one of its functions, your function will overwrite it.

So if you want to disable it, simply create a plugin with these lines of code:

if ( !function_exists( 'wp_password_change_notification' ) ) {
 function wp_password_change_notification() {}

Update: Earlier I said that you could write these lines in your functions.php but as Stefan pointed out, it does not seem to work

Tagged with: , ,
Posted in Beginner

Automaticly upgrade your local WordPress installation

This will only work with Mac OS X and Apache.

I have many WordPress installations locally. All of which grows outdated as time flies by. Normally I don’t worry about it since the live version is easily upgraded with WordPress automatic upgrade. But as of lately, I want to do this locally. But when I try to, WordPress asks for FTP-credentials.

So here is how you can bypass it.

First of all, add the following lines to your wp-config.php

define('FS_METHOD', 'direct');
define('WP_TEMP_DIR', ABSPATH.'wp-content/tmp');

Create a folder called tmp in your wp-content folder and make both of them writable.

Now, whenever you want to do an upgrade do the following steps:

  • Fire up Terminal and browse to your WordPress folder
  • Change ownership of the WordPress files to your Apache user. By default your user is called _www, as well as your group.
    sudo chown -R apacheuser:apachegroup .
  • Do the automatic upgrade!
  • When you are finished revert the ownership back to yourself
    sudo chown -R yourmacuser .

I have seen other blog posts about this, but all of them involved changing a lot of file permissions, which I didn’t feel comfortable with. So I follow these steps every upgrade and it works pretty well!

Tagged with: ,
Posted in Intermediate, Misc

Set WP_DEBUG to true during development

During development WordPress provides you with another error reporting tool apart from the normal PHP errors and warning.

Edit your wp-config.php file and find the row where WP_DEBUG is defined and set it to true.

define('WP_DEBUG', true);

This will make your site print WordPress related errors and warnings. This is very useful if you want to avoid using deprecated functions, variables, files and much more.

Tagged with: , , ,
Posted in Best Practices, Intermediate

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Fresher than ever.

Crunchy numbers

Featured image

A helper monkey made this abstract painting, inspired by your stats.

A Boeing 747-400 passenger jet can hold 416 passengers. This blog was viewed about 8,200 times in 2010. That’s about 20 full 747s.


In 2010, there were 21 new posts, not bad for the first year! There were 2 pictures uploaded, taking up a total of 103kb.

The busiest day of the year was February 26th with 88 views. The most popular post that day was Plugin: Easy Flash Embed.

Where did they come from?

The top referring sites in 2010 were WordPress Dashboard, wordpress.org, belbiy.com, en.search.wordpress.com, and infosonic.wordpress.com.

Some visitors came searching, mostly for wp_list_pages start_el, wordpress menu walker, wordpress allowed tags, wordpress custom walker, and wordpress body_class.

Attractions in 2010

These are the posts and pages that got the most views in 2010.


Plugin: Easy Flash Embed February 2010


Create a custom menu by creating your own Walker July 2010


Embed Flash files in WordPress March 2010


Custom CSS class for your menu items February 2010


How to change the allowed HTML tags for WordPress March 2010

Posted in Uncategorized

WordPress Quick Tips is a blog supplying great tips about WordPress.

We hope to create a great knowledge resource for WordPress developers as well as serving a reminder for all the forgetful ones.

The blog is created and run by Vincent of Oakwood Creative

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 121 other followers

%d bloggers like this: