4 cool and useful things in the next version of Simple Fields

Simple Fields is taking a big step forward with the upcoming version 1. Some of my favorite things:

1. Fields now have slugs (yes, finally!)

Just like posts and stuff around in WordPress, fields can nog have slugs. You can then access the values of the fields using slugs instead of annoying ids. Hooray!

2. You can add your own Field Types with the new Extension API

Now there is no limit to what you can do with Simple Fields. With the all brand new Extension API you can develop your own field types. Or why now download new field types made by other users of Simple Fields?

3. Fields can be added without using the GUI

Yes, another API! Simple Fields now includes functions to add Fields, Field Groups, and Post Connectors using only PHP. No GUI necessary. This is great news for theme developers or for developers who doesn’t want the GUI visible at all for their clients.

4. Access to the saved values are much easier

Oh, this is my favorite. Remember the clumbsy simple_fields_get_post_value-function that you had to use all the time? And you had to keep track of what field group id and what field id to get? Oooooooh it was so cumbersome.

Well, no more. Say hi to the new functions simple_fields_value() and simple_fields_values(). They are used to get the first (and possibly only) value from a field group, or to get all values from a field group. And you can specifiy what field to get only using the new slugs feature. It’s shorter and more in “plain text”.

Quick example:

Say you have a field with the slug “author_description”. To get the value from this field and print it out, all you have to write is:

[php]
$authorinfo = simple_fields_value("author_description");
echo "
<div class=’author-description-box’>
<h3>Author description</h3>$authorinfo
</div>";
[/php]

Or if you want to get values from multiple fields:

[php]
$authorinfo = simple_fields_value("author_description,author_image");
$author_image = wp_get_attachment_image_src($authorinfo["author_image"], ‘thumbnail’);
echo "
<div class=’author-description-box’>
<h3>Author description</h3>
$authorinfo[author_description] $author_image[src]
</div>";
[/php]

…and a bonus useful thing: You have access to a helpful and useful developer debug box

When developing a site it can be very useful to see and know that fields are being used for each post. This new setting enabled output of all fields by hooking onto the “the_content” on each post, so when viewing a post on your site you can immediently see what fields your post has and what their values are.

It looks like this btw:

One thought on “4 cool and useful things in the next version of Simple Fields

Leave a Reply