WordPress Plugin: DateArchives
I just wrote a simple WordPress plugin which creates post archives which are categorized by date. You can find an example of the plugin in action on the new archives page.
Installation
- Copy the code linked at the end of this post into a new file
- Save the file as something like datearchives.php
- Upload your new file into your wp-content/plugins folder
- Enable the plugin in your WordPress backend
Parameters
The plugin takes three optional arguments:
void DateArchives ( [ string $headingtag [, string $splitformat [, int $limit ]]] )
- string headingtag
- HTML tag which will be used for headings.
(defaults to h2) - string splitformat
- String in strftime format which defines how posts should be categorized. Maybe better to understand if you take a look at my archive page – there I used the default format which results in categories like ‘June 2008′. By changing this string you can categorize your archives by day, month, year, even by hour if you wish so.
(defaults to %B %Y) - int limit
- If you got many posts you may want to limit the output to a certain amount of posts. Will output all posts if set to 0 or null.
(defaults to null)
Note: As all parameters are optional, you can omit them all if you don’t need to tweak the plugin’s output.
AutoThumb WordPress plugin and English posts
![]()
I’m proud to announce two first-timers today: my first officially released WordPress plugin and the first page on this blog I wrote in English. It’s kind of a challenge to my English skills, so please correct me if you find any errors — I’m sure you will ;)
The plugin integrates the great phpThumb library into WordPress and therefore allows you to post images in different sizes flexibly.
Here we go: WordPress Plugin: AutoThumb
WordPress Plugin: AutoThumb
After switching my blog to WordPress I needed a simple solution which allowed me to flexibly post images in different sizes without having to hassle with different filenames, paths etc.
The plugin is actually just a port of a plugin/snippet I wrote for MODx a while ago (see here). It scans your content’s source code for <img> tags with width and height attributes and passes them to phpThumb, a great PHP image editing library, which handles the resizing and editing of the image. Additionally, by passing parameters to phpThumb using a query string, it’s possible to edit the image in several ways (take a look at phpThumb’s demos).
The simplest way to get resized images is to specify width/height attibutes in your HTML. Autothumb will use the given values and remove the attributes from your page’s output. When you take a look at the URLs of the following example images, you will see that the <img>-tag’s src-attribute points to a file called image.php in the plugin’s directory. This file takes the image source and several other parameters and passes them to phpThumb, which will generate and output the final image (of course images will be cached).
To prevent evil people playing with the query string and letting your server generate tons of different images, the plugin generates a hash which is a combination of the query string and a secret password you set in phpThumb’s config file. So every call with different parameters (even the same image with different sizes) has another unique hash and it’s not possible to generate new images without knowing the secret password.