Comment Autogrow: Version 1.0

I was using the autogrow script for my Front-End Editor plugin and thought it would be also useful for the comment textarea.

So I wrote this small plugin. To test it, start typing in the comment section below. Don’t press submit because that’s not the point.

Front-end Editor: Loading only on certain pages

Here is a foolproof way to make only parts of your site editable:

function front_editor_disable() {
	if ( ! is_single() )
		return true;
}
add_filter('front_end_editor_disable', 'front_editor_disable');

Just add that code in your theme’s functions.php file and you’re good to go: the plugin will work only on single posts.

Feel free to replace is_single() with whatever condition you need.

Event Pooling with WordPress

While reading an article about Event Pooling with jQuery, I realised that WP has an equivalent system, namely hooks. Here is a little map:

jQuery WordPress
.bind() add_action()
.unbind() remove_action()
.trigger() do_action()
event.type current_filter()

Of course, it’s not a perfect 1:1 match.

WordPress also has filters, besides actions, and a few other functions for controlling both. jQuery, on the other hand, gives you the possibility to bind an event to one or more elements on the page.

The important thing is that if you understand one system, you will easily comprehend the other. I guess this is another reason why jQuery is the prefered library for the WordPress admin.

Custom Field Images: Version 2.0

Version 2.0 adds a feature that should have been there from the beginning: instead of storing the image URL, it stores the image ID (for images uploaded to the site), along with the desired size.

You’ll notice the change when you use the Insert CFI button to add an image. Otherwise, you can still add the URL by hand.

A Default URL option was also added in this version, so that all posts can have an image, making your site more uniform.

The template tags have also changed, for the better, I hope.

These are the declaration for the template tags now:

custom_field_image($post_id = '', $defaults = '');
 
get_custom_field_image($post_id = '', $defaults = '', $format = 'html');

Say you want to override the default alignment. You can do that by adding this code:

If you also wanted to override the alt text, you would do this:

And so on, with any parameter: url, id, size, align, alt, link.

Props to Separatista for taking the time to make a Czech translation.

And props to Mike for pitching in with suggestions.

scbFramework: Version 1.1

The first update for scbFramework has an important bugfix in the scbOptions class.

The scbBoxesPage now creates perfect WP 2.8 style dashboard-like admin pages.

Also, several methods have been added and revised in scbAdminPage. Because of this, version 1.1 is not fully backwards compatible.

You can see all the changes from version 1.0.1 here.

Front-end Editor: Version 1.0

The new feature in this release is the possibility of editing a single paragraph in a post, instead of the whole post. If you want to go back to the old behaviour, you can uncheck the new checkbox from the settings page.

Speaking of which, the settings page is now split into two dashboard-like boxes.

Translating plugins

So you want to translate one of my plugins. If it is translatable, you will find the .pot file in the /lang/ directory of that plugin.

If you don’t know what to do with it, you can read about the process here.

If you want to share your translation with the rest of the world, feel free to send me the .po and .mo files at mail@scribu.net so that I can include them with the plugin.

Smart Archives Reloaded: Version 1.5

This version adds a new setting, namely the ability to display the month links in the block as numbers from 01 to 12.

The plugin is now fully translatable.

Finally, the cache file is now located in the uploads directory, so that you don’t have to mess with file permissions anymore.

Custom Field Images: Version 1.9

Finally, an update to my most popular plugin. Here is what’s happened:

If you’re writing a post and you upload an image, The (Insert CFI) button will be there. This is probably the most expected feature. Unfortunately, if you’re using the flash uploader, the button won’t appear immediately.

There is now a single admin page, with two boxes: one for settings and one for importing / exporting / deleting.

Last but not least, the plugin is now fully translatable.

All plugin features should work fine with WP versions older than the newly released 2.8, except for the CFI Loop widget.

PS: There’s also a new template tag: get_custom_field_image(). You can find out more about it in template-tags.php in the plugin dir.

scbFramework: How to use scbFramework in your plugins

Before making this framework public, I used to include the files with each plugin. As the number of plugins increased, I had to update each one every time I modified the framework.

After a while, I found a way to make all plugins on an instalation use the most recent framework version installed. This didn’t help much.

Finally, I made it a standalone plugin which you only need to install once.

So, currently, there are two possibilities:

Standalone plugin

As long as the scbFramework plugin is activated, your plugin will work perfectly. If you want to spare users from ugly error messages, you can include a small file, called scb-check.php. It will check that scbFramework is installed and if not, it will deactivate your plugin and display a friendly notice with an install link.

Including class files

If you don’t want to require users to install the standalone plugin, you can include all the class files with your plugin. You will also want to include another file, called load.php that takes care of autoloading classes as needed. (It will have to be placed in the same directory as the class files)

You can see a usage example by looking at the Front-end Editor plugin.