Types and Views 1.0 Features Preview
Types and Views 1.0 are scheduled for about 3 weeks from now and we’d love to hear your opinion about upcoming features.
Classic Repeater Fields
This time, you’re getting what you asked for, without any innovations or smart excuses.
We’re making every field kind in Types repeatable (perhaps with the exception of WYSIWYG fields). When you edit a custom fields group, you’ll be able indicate which field can appear multiple times in content editors.
If you allow a field to repeat (“this field can appear multiple times when editing”), you’ll have button to add more and delete.
Types saves these fields as independent postmeta entries. This means that when you click on ‘add another’, Types will create a new custom field, with the exact same name and add it to the post.
As a result, these fields cannot be ordered in the post editor. We’ve debated about this, going back and forth between using independent fields with the same key and a serialized array with all fields in it. Eventually, we selected to use multiple fields, as this seems to be fit best with WordPress and will be compatible with anything else that you can use. It also allows filtering by field values, which we think is a pretty big deal.
When you load the custom fields, you’ll get an array, which you can sort in the PHP (or Views will do it for you).
In the future, we might consider adding a second option for storing these custom fields as one serialized array, but it’s not implemented right now.
Grouping repeating fields
When you have groups of repeating fields, we think that container objects are suitable.
Let’s compare between two cases, where you might use repeating fields:
- Multiple email contacts for a vehicle
- Different engine attributes for a vehicle
The first example would be best implemented using the new repeating fields that we’re now adding to Types and Views 1.0.
The second example should use child posts. Yes, it’s technically possible to add them by grouping repeating custom fields and attaching them to the ‘vehicle’ post – but does this really make sense? If the group represents an ‘engine’, why not put all these fields under Engine and have Engines as children of Vehicle?
The second major new feature in this release is time-filters in Views. Until now, filter items according to time was pretty difficult (hackish). This made things like event managers difficult to build with Views.
Views 1.0 will let you filter time and date fields in a natural way. You’ll be able create filters relative to the current time or a fixed date. For example, if you want to load all events for today, or all events in the next week, that’s going to be trivial to do.
Feeding arguments to Views
The last big thing that we’re including in this release is a way to control Views query using URL arguments.
Supposing you’re doing a listing site and you have items in different categories, or with different attributes (custom fields). Wouldn’t it be nice if visitors could see a drop-down with price ranges, select one and the View on the homepage would update to show just the relevant items?
Views 1.0 will let you easily output HTML for View filters. For instance, you’ll be able to create drop-down lists with price ranges, check-boxes for colors or whatever you use to organize content.
The View will get that selection and use the values as filter arguments. This feature is still very much under construction. I’ll have detailed instructions and screenshots to share as we approach the first beta.
Finally, Types and Views localized
Types and Views 1.0 will ship with translation to Spanish, French, Chinese, Italian, Dutch, Russian and possibly other languages. We fixed a few bugs related to loading .mo files and localization now works correctly.
If you need translation to any of these languages, you’re all set. If you’re translating to another language, this time, the .mo files that you create will load. Amazing, isn’t it 😉
Beyond Version 1.0
After this 1.0 release, we’ll be looking at better integration with search plugins (to make it easy to search through custom fields), View support for the standard WordPress index, taxonomy and archive pages and lots of other goodies.
What do you think about these features? We’d love to get your feedback!