Types and Views 0.9.5 – Post Relationship, Better Performance and Streamlined Interface
We’re excited to announce Types and Views 0.9.5. This version is the result of two months of intense development by the entire team and brings a host of new features, improvements and a few fixes.
As always, our goal is to let you build even richer sites with Types and Views and do it easier.
When we asked you about repeater fields, we received a huge amount of feedback, which helped us craft the new features for this release. After careful review, we concluded that field arrays for the ‘parent’ post don’t sit well with how Types and Views work. We dug in deeper and came up with our own architecture for implementing arrays of related information.
Many of the sample uses talked about examples such as artists who have shows, products that have benefits and other things that look awfully close to parent /child relationship between different posts.
So, in order to build even stronger infrastructure, we decided to add a complete framework for parent /child relationship to both Types and Views. As before, Types defines the relationship and Views takes care of the display.
To achieve the same functionality as repeater fields, which belong to one post type, we’ve added a way to make one post type the parent of another AND to edit the child posts right from within the parent post editor. This provides the convenient editing for repeating information, but doesn’t sacrifice database integrity on the way.
With Types 0.9.5, when you edit a custom post type definition, you’ll see a new ‘post relationship’ section.
Once you’ve made one post the child of another, you open a whole new set of possibilities.
- You can edit child posts from within the parent editing (see Field Tables below).
- When you edit a child post, you can indicate who it belongs to, using a parent drop-down.
- When you display parent posts with a View, you can display the fields of the child posts.
There’s already a manual page about post relationship. It shows a simple example of a house that has rooms (but these rooms can also have furniture) and a more complex, but very realistic example, of a car-hire site.
When you define post relationship you allow one post to point to another. You can use this relationship to display fields that belong to the parents.
Now that you’ve defined relationships between posts, it’s time to put them to good use.
First, you’d probably like to add some custom fields to the child posts. Then, you’ll be able to edit the child posts and their custom fields, in a neat table, directly from the parent post.
But wait, is this thing exactly like repeater fields?
Not really. There’s a whole lot more to editing child posts in a table.
A child post can belong to different parents. In our car-hire example, agreements belong to both a person and a car. When you edit a person, you’d like to see all the rental agreements that he has. When you edit a car, you should see all the renters that this car had or are scheduled to have.
The ‘rental agreement’ type may have many fields. Not all are relevant for different parents, so Types lets you choose which fields to display when editing different parents.
You should read more about bulk editing with Field Tables to see how it works and what you can achieve.
Displaying child contents (Field Tables)
So, we’ve added a way to define post relationship and to edit child posts from the parents. Now, we just need a nice way to display all this information.
Views 0.9.5 can query and filter posts according to their parents. When you create a new View and the post type you’re querying has parents, you can choose to filter by those parents.
Like with ordinary WordPress pages, you can filter by the current parent or the parent set by the View. I hope that this last sentence doesn’t confuse for too long. The meaning is that you can easily have nested Views, showing child fields. For example, if you’re showing houses, each house can have a child View for the rooms.
This manual page about displaying child items explains how to easily display them using either a View, or with the new PHP API in Types 0.9.5.
This release sees a big performance boost in two places:
- In the WordPress admin, we’re doing far fewer SQL queries in the post-edit and in Types setup pages.
- AJAX page loads are now running without calling wp-admin and are cache-able. Just for figures, on our own 8-core dedicated server, this brings it down from 2.5 seconds to less than 0.1 second. If you’re using AJAX updates in your Views, you’re going to feel the improvement immediately.
Between all the shiny new features, performance improvements and bug fixes, this is actually my favorite new thing in Types and Views 0.9.5.
I’m acting as our webmaster. This means that I create new Views and Content Templates. I have a few other daily tasks, so I really like it when my webmaster role takes as little time as possible (and I can run the business).
Until this release, the field-insert popup dialog (which you get when you click on ‘insert field’ or the V icons) was a little cluttered. It could be a lot cluttered if you have lots of custom fields in the site (like we do).
To me, this was a big problem. I know what I want to insert, but I had to spend 3 minutes just finding it on the screen.
Views now does its best to eliminate options and show you only relevant fields. When you create a View, it knows exactly which content types you’re using. For Content Templates, it shows everything, but much more orderly.
Then, there’s that little search box. Try it by typing anything. You’ll see the fields list immediately adjust and irrelevant fields drop away. After entering just a couple of characters, you’ll immediately see the field you want to insert.
Since we had ample time to develop and review this release, we feel that it’s the most stable release to-date. It’s the first time that we managed to pass Types and Views through our complete QA cycle. This helped reveal numerous bugs, ranging from tiny wording issues to PHP bugs.
Types and Views 0.9.5 are already powering our own sites and we’re very happy with how it works for us.
Most bugs were difficult to get to, and are even more difficult to explain. However, there are a couple of things that stand out:
- WPML integration – now that wp-types.com is turning multilingual, we noticed a few places where Views was pulling items in the wrong language from the database.
- Fields not rendering – this is somewhere in the middle between Types and WordPress core. Since we can’t control WordPress, we fixed it all on our side. Types will now insert fields that are 100% compatible with how WordPress parses shortcodes, eliminating the possibility of fields not being displayed.
Getting Types and Views 0.9.5
You can download Types 0.9.5 from the WordPress download page or from your wp-types account. Views 0.9.5 is only available to Views clients. Please login to your wp-types.com account and click on Downloads.
We’ve done a ton of testing on these versions and they are already powering our sites. However, it’s a major update, so before updating live sites, please please backup your database.
Version 0.9.5 is the last one in Views beta. We’ll be moving to the first non-beta release next week, calling it Types and Views 1.0. During this time, our mission is to clean any problem, warning, notice or glitch that anyone sees and to complete other tiny issues that we left out from this release.
After 1.0, we’ll be back to adding more features.