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.

comments powered by Disqus