Blog

WordPress feeds mashup widget

I’ve put together a few little widgets in my time for client sites, dropped into my custom theme’s functions.php. I might look into putting them out there in a formalized way some time (plugins? a collection of code snippets?), but for now here’s one I just did that I think is pretty useful. It basically takes one or more feed URLs, and outputs the most recent items after merging the feeds together.

Read more »

WordPress Custom Fields plugin

Well, it turns out that my release of a “reloaded” version of my hugely popular custom fields theme code was a bit premature. I quickly realized that even though (or especially because) my target audience is developers, the code should become a plugin. The field definitions should be separate, in the theme, so the core plugin code can be easily update. D’uh!

So, while I’m not officially releasing the plugin yet on the WP repository, I thought I’d kick off a public beta. Check out the SLT Custom Fields plugin. Documentation is incomplete, and bugs may exist. However, all functionality seems to be working good on test sites. Use on production servers at your own risk, but please report any problems here.

I’m hoping this will grow into a powerful and stable tool for WordPress custom theme developers.

Read more »

WordPress custom fields reloaded

PLEASE NOTE: This code has now evolved into the Developer’s Custom Fields plugin.

My post on controlling your own WordPress custom fields is by far and away the most popular post on this site. Maybe I should monetize it or something?

Well, for a start, as a good friend once said, the word “monetize” should be take outside and shot. Besides, building WordPress sites does very well for me.

A better idea: improve the code!

Read more »

Fading in images sequentially in jQuery

This took me ages to figure out. I don’t know why. Anyway, I was creating a gallery of thumbnail images, and I wanted each image to fade in sequentially. The next image would start fading in before the previous one’s jQuery fadeIn had completed, so I couldn’t really use a callback.
Read more »

Custom fields for custom post types

I’ve just updated my most popular post, Control Your Own WordPress Custom Fields. It’s a long-overdue change, which allows for custom post types.

One thing is, as far as I can tell, when you set properties in PHP classes, you can’t use “dynamic” values. In the new version, there’s a property called $postTypes. I wanted to use get_post_types() to dynamically include public custom post types as well as the standard “post” and “page”, but I kept getting “unexpected (” errors. For now, I’ve hard-coded an array that can be added to. Does anyone know a more elegant solution? The only thing I can think of is using a method, though maybe I’m misunderstanding what I’m doing in terms of using a property.

Anyway, I’ve re-opened the comments over there, so do chip in with ideas!

WordPress Media Library URLs

Many, many times in my custom WordPress development, there are situations where I have to ask clients to grab the URL for an image from the Media Library. Maybe to paste into a widget or a custom field? In any case, to get the URL of the file, by default in WP you have to edit the media first—you get a read-only input called File URL.

Wouldn’t it be easier if the URL was output in the main list? I posted some code here a while ago to do this. But what if you want to make the URLs for all the different sizes of images in the Media Library available? I thought I’d revamp my code to tackle this and post it afresh here.

Read more »

jQuery image hover effect

I’ve just been trying to replicate a certain effect I saw in Flash image gallery with jQuery. When you hover over a thumbnail, it “glows” a little—not an “outer glow”, but the whole image just becomes brighter for a moment then the brightness fades back.

A very simple effect, and in the end doing it in jQuery was pretty simple, but I thought I’d document it. My technique has one caveat: it relies on the background being white, because it basically achieves the effect by temporarily reducing the opacity of the thumbnail image. If you have a background colour different from the colour you want the image to “glow” with, I’m sure there’s a way. You could probably use positioning to put a blank white image behind the thumbnail, and use this technique as-is.

Read more »

Blog archive