WordPress Latest Entries
Jul 18, 2010
Free Software, WordPress
Here are some views expressed by Linus Torvalds about the Linux kernel, plugins and how he thinks about derivative work. Very relevant to what I said about plugin interfaces and user space.
So, do themes and plugins serve a system-level or a user-level function?
p.s. Some have compared WordPress plugin and theme API to the way Linux loads kernel modules, when in fact relating it to system call interface (SCI) would be more appropriate.
#
Jul 17, 2010
Free Software, WordPress
It is interesting how thinking and understanding of ideas change over time. This morning I woke up and started reading the GPL licence with the intent to take another look at what it actually stands for.
I have come to conclusion that its purpose is to give everyone the freedom to do whatever they want with my work as long as they retain the freedom to derive from it.
With every software there are only two things one can do with it — either run it or modify it. By applying the GPL licence to my original work I am making sure that these two things can always happen and nobody can take those freedoms away. Read more »
#
Jul 11, 2010
WordPress
Here are two sample scripts along with an API to provide automatic updates for plugins and themes you host on your own server.
Inside /api you’ll find index.php which processes all the update requests. You should place this in something like http://updates.example.com and update $api_url in /plugin/test-plugin-update/test-plugin-update.php and /theme/portfolio-racer/inc/updates.php accordingly. If you activate these sample plugins without changing API URL, updates will be checked against my test server. If you decide to update, both plugin and theme will be replaced with exactly the same version of each.
#
Jul 9, 2010
WordPress
Here is a fix to make the OpenID plugin (version 3.3.2) work with PHP 5.3. Without it, you would get an error when trying to login:
This is an OpenID Server. Nothing to see here… move along.
#
Jun 26, 2010
WordPress
This plugin sets a “version” cookie of your site’s content, which can be used for time-based cache invalidation, as the cookie is checked and updated (if necessary) on each page request through a single AJAX request.
Download: ajax-cache-purge.zip (June 26, 2010)
Installation
Please note that this plugin is intended for people who run their own servers.
- Upload and enable the plugin.
- Add the value of
wp_cache_key_cookie to the cache key.
Nginx Example
fastcgi_cache_path /var/www/cache levels=1:2
keys_zone=wp-cache:10m
inactive=2m max_size=2000m;
fastcgi_temp_path /var/www/cache/tmp;
server {
# other config options
location ~ \.php$ {
# Cookie is supplied by the plugin
set $wp_cache_key_cookie 0;
if ($http_cookie ~* "wp_cache_key_cookie[^=]*=([^;]+)(;|$)") {
set $wp_cache_key_cookie wp_cache_key_cookie_$1;
}
set $wp_cache_key $scheme$host|$request_uri|args=$args$|$wp_cache_key_cookie;
#add key in header for debugging
#add_header WP_KEY $osc_cache_key;
fastcgi_cache wp-cache;
fastcgi_cache_key $wp_cache_key;
}
}
#
Jun 21, 2010
WordPress
Here is the new user interface that I have in mind for the next version of the Widget Context plugin. Feedback and suggestions from everyone currently using the plugin is much appreciated.

#
Jun 18, 2010
WordPress
Just took the time to create and implement the smartest WordPress cache solution of all time. If your server is able to use cookies for cache keys, I can send you a copy of the plugin to try it out.
#
May 2, 2010
WordPress
Here is a quick way to clear APC opcode cache with a single click within your WordPress dashboard Read more »
#
Apr 28, 2010
Web Design, WordPress

This server uses PHP 5.3 with PHP-FPM (FastCGI Process Manager) patch and APC opcode cache. Several minutes after activating APC, I noticed that some pages stopped loading. Turns out it was because of an APC timebomb bug which is when all cache writes got locked because of expiring cache entries and new writes happening at the same time. The temporary solution is to add apc.write_lock = 1 in php.ini.
#
Apr 5, 2010
WordPress

Select images for each gallery
I have updated the Multiple Galleries plugin to work with WordPress 2.9 and also 3.0-beta1. Another good news is that the plugin is now in the official repository. Those of you who are already using the very first version of this plugin will get an automatic notification that there is an update available. How lovely.
#
Feb 24, 2010
WordPress
Here are some of my random thoughts after going through the files of the new TwentyTen (2010) theme which will be introduced in WordPress 3.0.
header.php isn’t poetry at all
The content of the <title> should be generated within functions.php by using the wp_title filter, so that plugins and users can overwrite it. In header.php we would have only:
<title><?php wp_title('|', true, 'right'); ?></title>
and in functions.php something like:
add_filter('wp_title', 'twentyten_title', 10, 2);
function twentyten_title($title, $sep) {
global $post;
$title = wptexturize($title);
$page_no = get_query_var('paged');
if (is_front_page())
$title = get_bloginfo('title') . ' ' . $sep . ' ' . get_bloginfo('description');
elseif (!is_feed())
$title .= ' ' . get_bloginfo('title');
if ($page_no > 1)
$title .= ' (page ' . $page_no . ')';
return $title;
}
Theme’s stylesheet style.css should be loaded after the wp_head() call, so that users can overwrite styles added by the plugins. Read more »
#
Feb 2, 2010
WordPress
Parups.com is the very first website running a child theme of Portfolio Racer. The following plugins are helping out behind the scenes — Google XML Sitemaps, Infinite Scroll, Page Menu Editor, postMash (Filter), Top Level Categories, Widget Context and WP Super Cache.

Open source rocks!
#
Jan 13, 2010
WordPress
Justin Tadlock’s Cleaner Gallery plugin fixes the semantics of the WordPress built-in gallery feature by placing all of the gallery related CSS in an external file instead of the inline CSS produced by WordPress core.
However, the problem is that this CSS file is loaded on every page request. Therefore, until WordPress supports combining all CSS files into one, here is a quick way to hide this CSS file on all pages that don’t contain a gallery (line 128 of cleaner-gallery.php):
Note: this will add cleaner-gallery.css only on single post and page views (not indexes or archives).
add_action('wp_head', 'cleaner_gallery_head', 0);
function cleaner_gallery_head() {
global $post;
if (strstr($post->post_content, '[gallery'))
wp_enqueue_style( 'cleaner-gallery', CLEANER_GALLERY_URL . '/cleaner-gallery.css', false, 0.7, 'all' );
}
Hopefully, Justin can incorporate this into the next release of this handy plugin.
#
Dec 26, 2009
WordPress
Update: Ryan has made this into a plugin — Code Comments.
Add this to your theme’s functions.php to allow readers post fragments of code in their comments (wrapped in <code>...</code>) which are automatically encoded (think of < and <)
add_filter('pre_comment_content', 'encode_code_in_comment');
function encode_code_in_comment($source) {
$encoded = preg_replace_callback('/<code>(.*?)<\/code>/ims',
create_function(
'$matches',
'$matches[1] = preg_replace(
array("/^[\r|\n]+/i", "/[\r|\n]+$/i"), "",
$matches[1]);
return "<code>" . htmlentities($matches[1]) . "</code>";'
),
$source);
if ($encoded)
return $encoded;
else
return $source;
}
Worth noting:
- Everything wrapped in
<code>...</code> is encoded.
- Line breaks after opening
<code> and before closing </code> are removed in order to avoid unnecessary <br /> tags.
#
Dec 14, 2009
WordPress
Tabbed Widgets plugin has been updated — fixed default javascript variables.
#