Version 1.0.3 of Simple Fields was just released. Head over to wordpress.org to download (and give it a good rating if you have not done so already!).
This version adds a couple of new and nice things:
“Extended Return Values” added
One of the field types I use the most is the file field. It’s very easy for the user/editor to select their file. But for me as the developer it has always been a bit awkward to do anything with the file, because all you get in PHP is the file id. You have to manually check if the file is an image, get the thumbnail, do this, do that.
With Extended Return Values it will all be so much simpler: instead of just the id of the file you will get…well.. almost everything: the name of the file, the MIME-type, the URL to the file, a boolean telling you if the file is an image or not, and the URLs to all the different image sizes. Suddenly working with files (and all the other supported field types) will be so so so much easier.
Take a look at this quick example and you will get the hang of it:
[php]
// Without Extended Return Values
$file_id = simple_fields_value("my_file_slug");
$image = wp_get_attachment_image($file_id, "thumbnail");
echo $image;
// With Extended Return Values
$file_info = simple_fields_value("my_file_slug");
echo $file_info["image"]["thumbnail"];
[/php]
Read more about Extended Return Values over at the documentation pages.
Divider: a new field type
A new field type called “Divider” as been added. It’s a simple, decorative field type that is used to “make room” between your fields. If you have a lot of field in a field group it can feel a bit cluttered. The divider field type is meant to overcome this. It comes in two versions: one that simple creates a white space (well, actually grey space) and one that output a discrete line (as seen below).
Option to set height of textarea field
A height can now be set for both regular textareas and textareas with TinyMCE/HTML-editor. Useful since different textareas are used for different amount of information; sometimes the textarea was to small, sometimes to big. Now it will hopefully always just be good enough!
Small cleanup of Edit Field Group page
A small but important change is that I’ve made the edit field group page a bit more compact, so now almost twice as many fields are visible at the same time. Much more easy when you have a lot of fields and you need to drag and drop them.
Debug output changes
The debug output (that you can enable in the admin) now is a bit more clean and it also shows an example how you use it to fetch all the fields in a field area at once. Good, useful stuff for developers.