Views 0.9.4 adds Taxonomy Views, Conditional HTML and Other Goodies

We’re ready with Views 0.9.4. This release adds some great new features and opens completely new horizons for what you can build with Views.

Taxonomy Views

Until now, a View could query only the ‘posts’ table. This includes posts, pages and any custom post types. But, what about Taxonomy?

For example, supposing you’re keen on making a classified site, just like our new sample classified.

Sample classifieds site

The site revolves around categories. First, we display different product categories and then you can drill-down and see what they include.

The new Taxonomy Views does just that. Instead of querying the Posts table, it queries the taxonomy table.

But wait, there’s more!

Often times, you’ll also want to list posts that belong to each taxonomy. Let’s look at our sample magazine site:

Sample magazine site

You’ll notice that we’re listing two categories (technology and sport). Each of them lists several posts that belong to that category.

To build that, we use nested Views. The outer View loads and displays categories. The inner (posts) View displays the posts that belong to that category. When you edit a Post View, look at the ‘taxonomy filter’. You’ll see a new option to choose the taxonomy set by the parent View.

Conditional HTML

You may need to craft output HTML, as a function of post content. For example, look at this list of todos:

Todos list with items striked

Notice how a completed todo item is striked out? To build this, we need to wrap the title of completed todos with <del> and </del>. Of course, these del tags are added when we display the data and not into the database.

Views 0.9.4 has a new expressions-evaluation engine. This can include simple stuff like checking if a field or set and can go up to complex expressions that include logic conditions and combinations of any number of fields.

It’s documented in the conditional HTML output page.

This allows you to add ‘if’ logic to your Views and Content Templates. It gives all the power you’d have when coding in PHP, just without the actual coding.

Shortcodes within Shortcodes

Talk about something super technical…

Let’s say that you have a shortcode for an iPhone app (I personally use an Android device, but don’t worry about me).

Your shortcodes look like:

[app 12345]

Where that 12345 is the ID of a certain app. Now, you’re asking a pretty legitimate question:

“How do I control the ID of the application with a custom field?”

Unlike previous Views versions, Views 0.9.4 makes it look trivial. Just write:

[app  [types field="itunes-id"] ]

See? That wasn’t so bad. Now that you can use Types shortcodes inside of other shortcodes, you can user Types and Views to control your own shortcodes using custom fields. This includes all the standard codes (like Gallery) and your own ones.

Views Debugger

It’s great when things just work, but what to do when they don’t? For example, you created a lovely View and it’s returning nothing. Where do you start checking?

Since this happens to me on a regular basis and I don’t really enjoy firing up a PHP debugger, we added our own simple-debugger to Views.

Now, you can get a complete log of what Views does. It’s all documented in the debugging Types and Views page.

The debugger uses the browser’s console. If tells you which Views and Content Templates are loading, what they’re getting from the database and what they’re doing with it.

Views debugger

With this, you can immediately trace and understand what Views does and save on all that time spent on wondering and experimenting.

The debug output goes to the console, so you can enable it safely without compromising the HTML output.

Other New Features

Just a few other things and we’re done:

  • Added a way to order View results randomly
  • Add format parameters to the wpv-post-author shorcode
  • Add 2 additional options to the taxonomy filter for selecting taxonomy based on attribute passed to a View or passed by a URL parameter
  • Add “Edit Content Template” an shortcode “wpv-post-edit-link”

And, we’ve also fixed a number of bugs:

  • Fixed AJAX pagination for a widget View
  • Use the Content Template title instead of the Content Template ID in select boxes
  • Stopped hidden custom fields from displaying in the V icons or when adding fields to View layout
  • Using title instead of slugs in the table headings
  • Improved output of the excerpt shortcode
  • Stopped including the current post in the posts returned by a query
  • Fixed a bug that happened when there is more than one view on a page

Upgrading to Views 0.9.4

You should see this new version in your Plugins admin page in WordPress (WordPress has a 12 hours cache on new plugin versions). To upgrade automatically, be sure you’ve entered your subscription email and key.

You can also upgrade by downloading Views 0.9.4 from your account.

What do You Think?

We’d love to hear your feedback and see what you’re building with Views.

You’re invited to leave your comments here. If you want your site added to our showcase, head over there and fill the add-new-site form at the bottom.

30 thoughts on “Views 0.9.4 adds Taxonomy Views, Conditional HTML and Other Goodies

  1. Sean

    You guys are doing such a GREAT job with Types and Views!!! I can’t begin to tell you how many issues you all have solved for me and how easy everything is. You guys simply rock and if other people don’t tell you guys like they should, please allow me: THANK YOU.

    1. Amir

      Thank you very much for this great feedback. We’re using Types and Views in our own sites and it’s getting better because of all the great feedback, suggestions and ideas that we’re hearing from folks like yourself.

    1. Amir

      It’s not going to be implemented like the Repeater Fields in ACF. Instead, you’ll have child posts for repeating content.

      Types will implement the post relationship management and let you edit tables of related posts inline with the parent post. Then, Views will query that data and display it. I realize that this is sounding a little complex, but in practice it’s going to be very straight-forward to use.

      We should have a first version to see around next week. Then, some more time to polish things and be ready with a production release.

      1. Steve

        I don’t know what ACF means. We’ll be able to work with repeater fields without Views though, right? I don’t use Views, I prefer to roll my own php.

        1. Amir

          That’s correct. Types will include the bulk of the functionality, including defining what fields repeat and how they are edited. If you’re happy with PHP templates and WordPress API coding, you’ll have no trouble displaying the repeating data.

          1. Steve

            Awesome, thanks.

            Side note: I’ve coded my own CPTs, taxes, etc, and messed around with nearly every plugin (clearly not ACF though, which I just found ;), but Types is without doubt the cleanest, easiest, most comprehensive yet. You guys “get it”, which is such a pleasure. Keep up the great work.

            ps. Any plans to roll in custom admin columns? That would be icing.

          2. Amir

            At some point in time we’ll be looking into admin panels as well, but we have our hands full with other things for the next few months.

    1. Amir

      Yup. That’s coming too. We’ll have loads of specialty fields coming to Types, but first we’re going to add the big stuff (post relationship).

  2. Greg

    It’s not obvious (to me) how to do the taxonomy view/nested views combo (which will solve precisely the problem I’m working on now without adding ACF to the mix). Could you dump the settings and HTML with shortcodes so we can see the syntax?

  3. Enrico

    Amir, great work!! Your plugin is a game changer! The more I use it, the more I get its possible applications.
    Just a question, there’s a way I could use the new conditional tags to evaluate a date?
    “if the specified date is passed, then don’t show the post”. If date conditional evaluation is not available I guess I’ll immediately fill a feature request! :)

    1. Amir

      You got me there. I wanted to evaluate dates and found it difficult. You can use an integer for the date, but that cannot be relative to the current date. So, I can’t think of a way to test something like “now + 1 month”. I’ve already added this to our todo list. We’ll have a pseudo variable $now, which will return the current time as integer. Then, you can use math expressions to calculate future and past times.

  4. Ivan

    Cool, looks great! This is exactly what I missed.

    I’m looking forward to the documentation of the new features. I’m a simple user, not a programer. :-)

    1. Amir

      Glad to hear. Some new documentation is available:

      * How to use taxonomy views (complete tutorial) –
      * Updated Types field reference –
      * Updated Views reference, including conditional code –
      * New manual page about conditional code –

          1. Ivan Blatter

            I tried it according the Tutorial for the magazine theme but found a problem with Step 2b:
            Views doesn’t insert the field [wpv-view name="Category Posts Listing"] in the Meta HTML.

            After inserting manually it works great.

            I’m going to open a post in the forum.

  5. Francois

    Hello Amir,

    I’m playing with Types. I’ve got a behavior with the checkbox in the custom field wizard.

    I’ve tried to add a serie of checkboxes to indicate a range of similar value. And the “user created fields”, I see a multiplication of objects that are not available.

    in the database :

    If you want more details, don’t hesitate to contact me.


  6. Jeff Kemp

    Hi. I have a pre-sales question (not sure where else to ask since I don’t yet have an account).

    I’d like a way to use a shortcode to insert body content from a Type into an existing page (without using a custom template or View).

    Ex: Insert body content of Type = Product into a particular product page.

    Does Types or Views support that directly? Or is there another plugin you are aware of that would support that?


      1. Jeff Kemp

        Sorry, let me try to clarify…I don’t mean insert custom field data from some source into some page content…

        I mean I’d like to take the BODY CONTENT from a Type and insert it into an existing page using a shortcode (without using a custom template or View).

        Example: Insert BODY content FROM a ‘Product’ Type (that contains product detail or example) and insert it into another page (that contains product pricing for example).

        Unless you are referring to using a custom field in place of body content so that it can be inserted using a shortcode??

  7. Stephen

    I’ve longed for creating useful applications rapidly with WordPress like we did back in the day before the Internet with VB, Access and Crystal Reports, but to even compare the two would be an awful insult to Types & Views. You’ve done one hell of a great job! Keep up the awesome work and


    The runtime aka embedded feature is also one bad ass feature. Again, like the old school design time/royalty free runtime ActiveX components of yesterday, it’s a sure bet that this viral feature will take off. Can’t wait to publish my solutions with an affiliate link. You all rock!!!

  8. Chuck

    Wow! Well documented, well supported and great interface for developers and users alike. This is really great stuff! Thank you. I intend to purchase Views. Can’t wait for ability to create relationships between custom posts types. With that, I would have to seriously consider the WordPress “framework” as a viable alternative to Django or Rails.

    1. Amir

      Thank you for this feedback. We are also using Rails for different projects. This is why the post relationship in Types and Views will look so familiar to you.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>