Tag Archives: wordpress

CodeIgniter & Spaw Editor

I have released an updated version at http://sheldon.lendrum.co.nz/codeigniter-spaw-editor-tabs_411/10/. This new version allows CodeIgniter and SPAW TABS !

Recently I have been working on a large project for a National Sporting team, It has been a process and it is almost finished.
As part of this system, we have developed an extended custom content management system.

Finding a WYSIWYG Editor for these types of sites is a tricky thing. Your editor of choice needs to be complex enough to let the user Manage their site, but not too hard that they can’t and don’t manage it, yet not give them so many options that your beautiful design gets listed on some of the ‘worst’ design sites due to ‘Crazy Customisation’, bright, huge highlighted words, 5mb images on every page and so on… like a ‘Client goes Crazy’ Video.

WordPress uses TinyMCE editor from MoxieCode, which is what we first implemented, but the design agency requested that they can add inline images in to the content. ( Bad thoughts crept in to my mind of a horror site coming out ) but I decided this would be a nesscarry change.

I went back to an old faithful that Ryan & I have used for years on other CMS’s.
The issue with this is it uses it’s own class, and interferes with CodeIgniter, the PHP FRamework that we are developing this site in.

After some googling, I found a solution on the CodeIgniter Wiki. After installing it, I first found I needed some small customizations, and that it wasn’t a new version, and didn’t have Safari support, which both us developers, and the advertising agency use. So I went to work on repackaging SPAW 2.0.8.1 for CodeIgniter with a few extra plugins.

Download it for free and let me know how it works :)
check the new version with TABS
[download#6]

WPTouch – iPhone your WordPress

I came accross this sweet WordPress Plugin called ‘WPTouch today and have just installed it on this blog.

What it does, is create an iPhone friendly version of your blog. It has some sweet customisable features, like using Advanced jQuery Javascript Effects (ajax entries, ajax comments, smooth effects), Enable Gravatars in Comments.

When Advanced Javascript Is Disabled:

Your site loads faster on EDGE and 3G connections
Ajax & jQuery are not loaded & used for comments, entries, excerpts etc.
*Fixes javascript conflict issues where the WPtouch menu drop-down doesn’t work
When Gravatars Are Disabled:

Gravatar.com images are not shown beside commenter’s names
As a result, single post pages load faster on EDGE and 3G connections

It also allows for some customisation in how your blog is presented ( Icons, titles, Colours ).
Try it out on your iPhone or iPod touch, and if you are reading this from your iPhone already, then how do you like it ?

BlueSimplicity – WordPress Free Theme

This is a free WordPress theme available for download.

Is it a Clean, 2 Column Layout with a Left side Navigation / Sub Navigation. The Sub navigation uses Mootools to appear, and will display Posts under their Categories.

It has support for Gravatars and Widgets, includes the Header PSD and is fully xHTML and CSS Valid all for free!

Download: [download#3]

New Theme for Sheldon.Lendrum

I have just launched my site with a theme that I have made myself completely from scratch.

It uses multiple colour sets and some ‘grunge’ style imagery. Let me know how you like it, and if you come across any bits and pieces that aren’t working.

The site uses CSS 2/3 and xHTML code, with a heavily modified version of WordPress 2.6.02.6.1
I have made all hacks to WordPress 99.9% upgradable so should be good to go with upgrading to the newly released WP 2.6.1. was simple.

I hide all CSS and JS with some simple PHP code and have a colour changer in the top right. This sets a PHP cookie for 7 days on your computer, and nothing is harmful about my cookies :)

I have built in the CSS/JS for the plugins is use to reduce code and scripts that WP inserts, I really hate how if you use a couple of plugins there gets a mess of included files in the <head> of the pages.
Check out my source code, it is pretty, and you can’t view my CSS and JS files :)

Disabling WordPress Auto-Save and Revision Saving

When writing a post, I don’t often write it all in one go, then before I publish it, I save it and preview it, generally more than once.

WordPress has 2 Great ( or not ) features, Auto-Save, and Revisions.

When writing my last post Clean Dynamic Directory Listing with PHP I have some example code wrapped in <pre> tags and WordPress auto-validates code, which is a handy feature, but not here where I was trying to enter my example.
So after several saves, and eventually getting in to my mySQL database to fix it and seeing that for hat this time only having 22 posts/pages, my database shows 199 records!

Showing 199 Rows!

Showing 199 Rows!

To get directly to the point, some handy shortcut links:
Disable Auto-Saving
Disable Saving Revisions
Final code
Cleaning up the Database


Ok.. I’m no prude, I have plenty of server space and mySQL storage, and the POST data isn’t exactly huge, but still Thats crazy! And before you ask, No I am not one of those people that go and delete all my old or unimportant emails!
 

Disable WordPress Auto-Saving my Posts!

So, I looked in to it and found people hacking their wp-ajax.php and post.php and thought, Oh Hell No! That is going to break every time I update WP, and who knows what else.

So.. a little bit of digging in to my code and found what I needed.

Open your WordPress Config File:

/wp-config.php

And after the first set of functions I added this line:

define( 'AUTOSAVE_INTERVAL', 900 ); 

By Default this value is set to 60 (seconds), 600 equals 1 Hour, 900 equals 1 1/2 hours, you can go higher, but i figure 1 1/2 hours in my case is good.

Disable WordPress Revisions!

I dont need or want 10 revisions of my posts, I am the only one editing them and this is not a Wiki! One Post, One Revision!

In the WordPress Config File:

/wp-config.php

And after the first set of functions I added this line:

define( 'WP_POST_REVISIONS', 0 ); 

By Default this value is On (1), but turn it off by setting it to Off (0) ( Zero ).

Sheldons revised WP-CONFIG.PHP

< ?php
// ** MySQL settings ** //
define('DB_NAME', '*database*');    // The name of the database
define('DB_USER', '*username*');     // Your MySQL username
define('DB_PASSWORD', '*password*'); // ...and password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

// TURN OFF AUTO-SAVE AND SAVING REVISIONS
// THEY ARE MAKING A GOOD AWEFL MESS OF MY DB AND MESSING UP SETTINGS WHEN WRITING!
define( 'AUTOSAVE_INTERVAL', 600 ); // 60= 1 HOUR.
define ('WP_POST_REVISIONS', 0);    //  TURN OFF POST REVISIONS.

Cleaning up those extra 175 records!

Ok, I have disabled Auto-Saving and Saving Revisions, I am now a happy fella!
But what about those 100's of old records?

A simple mySQL Query will fix those !
In your wp-config.php file, Right at the bottom after the "require_once(ABSPATH . 'wp-settings.php');" Paste this Query, Load any page in your site ONCE and then remove the line.

mysql_query("DELETE FROM `wp_posts` WHERE `post_status` = 'revision'");

This will Delete all those Auto-Saves and Revisions :)

Now Showing 22 Records!

Now Showing 22 Records!

Please post your Questions, Comments and Concerns!

Note: Back up your SQL database first! This is working good on my version of WordPress 2.6 with a few MOD’s.
All consideration and Care, but no responsibility – Sheldon