WordPressThis is a tip for WordPress users trying to manage their blog using Apple’s Safari on OS X. WordPress is a great free blog engine that ReelSmart, and many many other sites are built on.

If you have your own WordPress blog installed and ever tried to add a post using Apple’s Safari browser you may have noticed that there are no editing buttons, called “quicktags” to allow for easy editing of your posts. I will show you how to change that.

Quicktags are these easy editing buttons below the word Post:

Write Post - Quicktags

This only applies to Safari and WordPress software that is installed on your server. Quicktags in Wordpress work just fine with Firefox and other browsers. This also does NOT apply to Wordpress.com which is the great free “hosted” solution.

Well the history behind this is simple. Safari did not support the javascript (JS) correctly that is needed for quicktags to work properly. Sometimes this even crashed Safari. The WordPress developers did not want users to think that is was WordPress’ fault that Safari crashed or did not work correctly, so they added a work-around to the WordPress code. They added a few lines of code that simply added a “browser-sniff” and turned off quicktags for Safari.

This work-around can be reversed safely and easily in most cases and Safari will now work just fine with quicktags and WordPress. What you will need is a text editor, an FTP client or FTP manager, and to follow these instructions adapted from the WordPress Codex.

Here’s how:
You will need to edit two lines in the /wp-admin/admin-functions.php file.

Download the /wp-admin/admin-functions.php file using an FTP client or a FTP Manager using your browser if your hosting company provides one. You will just need to edit the /wp-admin/admin-functions.php file and upload it back up to your server. Make sure to keep a backup of this file in case you make a mistake. Only after making a copy should you edit the original and replace the one on the server.

Using any good text editor, you will edit two lines of code. I use TextMate. But BBEdit, TextWrangler, or even the included TextEdit in OS X will work fine for this. All you need is a text editor that can save the opened admin-functions.php file back to a .php file. Of course, most WYSIWYG editors like DreamWeaver or GoLive can also be used. Same if you are editing the file on a Windows machine.

Remove the “if” statement on line 1085 and the word “else” on line 1092 of /wp-admin/admin-functions.php. If your text editor does not have any line numbers just cruise on down the list until you find the code you need to edit.

For example, change this (around line 1085):


function the_quicktags() {
// Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Safari'))
echo '

and this (around line 1092):


else echo '

to this, removing the “if” statement:


function the_quicktags() {
// Browser detection sucks, but until Safari supports the JS needed for this to work people just assume it's a bug in WP
echo '

and this, removing the “else” statement:


echo '

Now just save the file after you finished these simple edits, making sure it is saved in a .php file extension. Also make sure you do not change the name of this file.

Now upload the edited file replacing /wp-admin/admin-functions.php file on your server.

Safari should not display the quicktag buttons making editing posts in WordPress a breeze. If anything goes wrong you can always upload the backup file you made.

 Email Post Email Post  Print Post Print Post | Tags: , , ,