soderlind.no

I code for fun

11.1.2012
by PerS
6 Comments

WordPress plugin: Remove “Comments are closed”

On posts where comments are closed, the plugin will remove the text ‘Comments are closed.’ The plugin supports any languages/text domains, and will remove the text from themes and plugins.

Prerequisite: Since the plugin is filtering gettext, your theme/plugin must be localized.

The plugin is available in the WordPress plugin directory

View the plugin source code

25.9.2011
by PerS
41 Comments

Front-end editor in WordPress 3.3 is easy

Thanks to the work done by Andrew Ozz et al., adding a front-end editor in WordPress 3.3 is very simple.

Syntax:

wp_editor( $content, $editor_id, $settings = array() );

// default settings
$settings =   array(
	'wpautop' => true, // use wpautop?
	'media_buttons' => true, // show insert/upload button(s)
	'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here
	'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."
	'tabindex' => '',
	'editor_css' => '', // intended for extra styles for both visual and HTML editors buttons, needs to include the <style> tags, can use "scoped".
	'editor_class' => '', // add extra class(es) to the editor textarea
	'teeny' => false, // output the minimal editor config used in Press This
	'dfw' => false, // replace the default fullscreen with DFW (needs specific css)
	'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
	'quicktags' => true // load Quicktags, can be used to pass settings directly to Quicktags using an array()
);

View the wp_editor() examples

4.3.2010
by PerS
1 Comment

WordPress plugin template

UPDATE: As of WordPress 3.3, you shouldn’t use the wp_print_styles hook, I’ve updated the Adding JavaScript section below to reflect this change.

You can create a personalized plugin template by using my WordPress Plugin Template Creator

When I  rewrote my WP-DenyHost plugin, I wanted to do it as fast as possible. Instead of reinventing the wheel (again), I googled after a plugin template and found a very good one at Pressography. It had most of what I needed in a plugin template.

Continue Reading

10.2.2010
by PerS
1 Comment

Fighting spam

I have reduced the number of  splog attacks on my site

I use the Akismet and WP-DenyHost anti-spam plugins for WordPress. Akismet is a must-have and has, since I installed it, caught 304,056 spams (!!).  When Akismet catch a spammer, it logs the spammers IP address. WP-DenyHost, written by me, prevents spammers from getting access to my site a second time by blocking access from this IP address.

I installed WP-DenyHost in the fall 2009 and, as you can see from the graph above, the number of spam has dropped dramatically.

.

18.11.2009
by PerS
5 Comments

delicious tagroll for WordPress

October 25th 2011: Delicious has removed their javascript feed, and the plugin doesn’t work any more. I writing a new version, and will release it soon. The new version is available at WordPress.org

December 19th 2010: Rumor says that Delicious is shutting down, this is NOT true.

The Delicious tagroll for WordPress plugin adds a new shortcode to WordPress, the the shortcode shortcode. The shortcode creates a tag cloud or a list of tags (see parameters below).
Rodney's 404 Handler Plugin plugged in.